diff --git a/D177258.diff b/D177258.diff
new file mode 100644
index 0000000..0317a9d
--- /dev/null
+++ b/D177258.diff
@@ -0,0 +1,181 @@
+diff --git a/layout/reftests/xul/reftest.list b/layout/reftests/xul/reftest.list
+--- a/layout/reftests/xul/reftest.list
++++ b/layout/reftests/xul/reftest.list
+@@ -70,10 +70,12 @@
+ skip == chrome://reftest/content/xul/treecell-image-svg-1b.xhtml chrome://reftest/content/xul/treecell-image-svg-1-ref.xhtml # bug 1218954
+
+ != chrome://reftest/content/xul/treetwisty-svg-context-paint-1-not-ref.xhtml chrome://reftest/content/xul/treetwisty-svg-context-paint-1-ref.xhtml
+ test-pref(svg.context-properties.content.enabled,true) fuzzy(0-26,0-2) == chrome://reftest/content/xul/treetwisty-svg-context-paint-1.xhtml chrome://reftest/content/xul/treetwisty-svg-context-paint-1-ref.xhtml
+
++== chrome://reftest/content/xul/tree-scrollbar-height-change.xhtml chrome://reftest/content/xul/tree-scrollbar-height-change-ref.xhtml
++
+ # resizer (non-native-themed)
+
+ != chrome://reftest/content/xul/resizer-bottomend.xhtml chrome://reftest/content/xul/blank-window.xhtml
+ == chrome://reftest/content/xul/resizer-bottomend.xhtml chrome://reftest/content/xul/resizer-bottomright.xhtml
+ != chrome://reftest/content/xul/resizer-bottomend.xhtml chrome://reftest/content/xul/resizer-bottomend-rtl.xhtml
+diff --git a/layout/reftests/xul/tree-scrollbar-height-change-ref.xhtml b/layout/reftests/xul/tree-scrollbar-height-change-ref.xhtml
+new file mode 100644
+--- /dev/null
++++ b/layout/reftests/xul/tree-scrollbar-height-change-ref.xhtml
+@@ -0,0 +1,32 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff --git a/layout/reftests/xul/tree-scrollbar-height-change.xhtml b/layout/reftests/xul/tree-scrollbar-height-change.xhtml
+new file mode 100644
+--- /dev/null
++++ b/layout/reftests/xul/tree-scrollbar-height-change.xhtml
+@@ -0,0 +1,39 @@
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h
+--- a/layout/xul/tree/nsTreeBodyFrame.h
++++ b/layout/xul/tree/nsTreeBodyFrame.h
+@@ -114,11 +114,11 @@
+ nsresult ClearStyleAndImageCaches();
+ void RemoveImageCacheEntry(int32_t aRowIndex, nsTreeColumn* aCol);
+
+ void CancelImageRequests();
+
+- void ManageReflowCallback(const nsRect& aRect, nscoord aHorzWidth);
++ void ManageReflowCallback();
+
+ void DidReflow(nsPresContext*, const ReflowInput*) override;
+
+ // nsIReflowCallback
+ bool ReflowFinished() override;
+@@ -566,10 +566,13 @@
+ nscoord mHorzWidth;
+ // The amount by which to adjust the width of the last cell.
+ // This depends on whether or not the columnpicker and scrollbars are present.
+ nscoord mAdjustWidth;
+
++ // Our last reflowed rect, used for invalidation, see ManageReflowCallback().
++ Maybe mLastReflowRect;
++
+ // Cached heights and indent info.
+ nsRect mInnerBox; // 4-byte aligned
+ int32_t mRowHeight;
+ int32_t mIndentation;
+
+diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp
+--- a/layout/xul/tree/nsTreeBodyFrame.cpp
++++ b/layout/xul/tree/nsTreeBodyFrame.cpp
+@@ -363,34 +363,37 @@
+ // XXX is this optimal if we haven't laid out yet?
+ ScrollToRow(rowIndex);
+ NS_ENSURE_TRUE_VOID(weakFrame.IsAlive());
+ }
+
+-void nsTreeBodyFrame::ManageReflowCallback(const nsRect& aRect,
+- nscoord aHorzWidth) {
+- if (!mReflowCallbackPosted &&
+- (!aRect.IsEqualEdges(mRect) || mHorzWidth != aHorzWidth)) {
+- PresShell()->PostReflowCallback(this);
+- mReflowCallbackPosted = true;
+- mOriginalHorzWidth = mHorzWidth;
+- } else if (mReflowCallbackPosted && mHorzWidth != aHorzWidth &&
+- mOriginalHorzWidth == aHorzWidth) {
++void nsTreeBodyFrame::ManageReflowCallback() {
++ const nscoord horzWidth = CalcHorzWidth(GetScrollParts());
++ if (!mReflowCallbackPosted) {
++ if (!mLastReflowRect || !mLastReflowRect->IsEqualEdges(mRect) ||
++ mHorzWidth != horzWidth) {
++ PresShell()->PostReflowCallback(this);
++ mReflowCallbackPosted = true;
++ mOriginalHorzWidth = mHorzWidth;
++ }
++ } else if (mHorzWidth != horzWidth && mOriginalHorzWidth == horzWidth) {
++ // FIXME(emilio): This doesn't seem sound to me, if the rect changes in the
++ // block axis.
+ PresShell()->CancelReflowCallback(this);
+ mReflowCallbackPosted = false;
+ mOriginalHorzWidth = -1;
+ }
++ mLastReflowRect = Some(mRect);
++ mHorzWidth = horzWidth;
+ }
+
+ nscoord nsTreeBodyFrame::GetIntrinsicBSize() {
+ return mHasFixedRowCount ? mRowHeight * mPageLength : 0;
+ }
+
+ void nsTreeBodyFrame::DidReflow(nsPresContext* aPresContext,
+ const ReflowInput* aReflowInput) {
+- nscoord horzWidth = CalcHorzWidth(GetScrollParts());
+- ManageReflowCallback(GetRect(), horzWidth);
+- mHorzWidth = horzWidth;
++ ManageReflowCallback();
+ SimpleXULLeafFrame::DidReflow(aPresContext, aReflowInput);
+ }
+
+ bool nsTreeBodyFrame::ReflowFinished() {
+ if (!mView) {
+
diff --git a/D177902.diff b/D177902.diff
new file mode 100644
index 0000000..04a8f6f
--- /dev/null
+++ b/D177902.diff
@@ -0,0 +1,32 @@
+diff --git a/devtools/server/actors/resources/console-messages.js b/devtools/server/actors/resources/console-messages.js
+--- a/devtools/server/actors/resources/console-messages.js
++++ b/devtools/server/actors/resources/console-messages.js
+@@ -64,16 +64,23 @@
+ // that process (window and window-less).
+ // To do that we pass a null window and ConsoleAPIListener will catch everything.
+ // And also ignore WebExtension as we will filter out only by addonId, which is
+ // passed via consoleAPIListenerOptions. WebExtension may have multiple windows/documents
+ // but all of them will be flagged with the same addon ID.
+- const window =
++ const messagesShouldMatchWindow =
+ targetActor.targetType === Targets.TYPES.FRAME &&
+ targetActor.typeName != "parentProcessTarget" &&
+- targetActor.typeName != "webExtensionTarget"
+- ? targetActor.window
+- : null;
++ targetActor.typeName != "webExtensionTarget";
++ const window = messagesShouldMatchWindow ? targetActor.window : null;
++
++ // If we should match messages for a given window but for some reason, targetActor.window
++ // did not return a window, bail out. Otherwise we wouldn't have anything to match against
++ // and would consume all the messages, which could lead to issue (e.g. infinite loop,
++ // see Bug 1828026).
++ if (messagesShouldMatchWindow && !window) {
++ return;
++ }
+
+ const listener = new ConsoleAPIListener(window, onConsoleAPICall, {
+ excludeMessagesBoundToWindow: isTargetActorContentProcess,
+ matchExactWindow: targetActor.ignoreSubFrames,
+ ...(targetActor.consoleAPIListenerOptions || {}),
+
diff --git a/D178251.diff b/D178251.diff
new file mode 100644
index 0000000..249f9e5
--- /dev/null
+++ b/D178251.diff
@@ -0,0 +1,104 @@
+diff -up firefox-113.0.1/Cargo.lock.D178251 firefox-113.0.1/Cargo.lock
+--- firefox-113.0.1/Cargo.lock.D178251 2023-05-12 00:09:22.000000000 +0200
++++ firefox-113.0.1/Cargo.lock 2023-05-24 10:55:51.177278597 +0200
+@@ -417,8 +417,6 @@ dependencies = [
+ [[package]]
+ name = "bindgen"
+ version = "0.64.0"
+-source = "registry+https://github.com/rust-lang/crates.io-index"
+-checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
+ dependencies = [
+ "bitflags 1.3.2",
+ "cexpr",
+diff -up firefox-113.0.1/Cargo.toml.D178251 firefox-113.0.1/Cargo.toml
+--- firefox-113.0.1/Cargo.toml.D178251 2023-05-12 00:09:22.000000000 +0200
++++ firefox-113.0.1/Cargo.toml 2023-05-24 10:56:39.836959570 +0200
+@@ -119,7 +119,7 @@ tinyvec = { path = "build/rust/tinyvec"
+ wasi = { path = "build/rust/wasi" }
+
+ # Patch bindgen 0.63 to 0.64
+-bindgen = { path = "build/rust/bindgen" }
++bindgen_0_63 = { package = "bindgen", path = "build/rust/bindgen" }
+
+ # Patch memoffset 0.6 to 0.8
+ memoffset = { path = "build/rust/memoffset" }
+@@ -145,6 +145,9 @@ web-sys = { path = "build/rust/dummy-web
+ # Overrides to allow easier use of common internal crates.
+ moz_asserts = { path = "mozglue/static/rust/moz_asserts" }
+
++# Patch bindgen to work around issues with some unsound transmutes when compiling with LLVM 16+.
++bindgen = { path = "third_party/rust/bindgen" }
++
+ # Patch `rure` to disable building the cdylib and staticlib targets
+ # Cargo has no way to disable building targets your dependencies provide which
+ # you don't depend on, and linking the cdylib breaks during instrumentation
+diff -up firefox-113.0.1/supply-chain/config.toml.D178251 firefox-113.0.1/supply-chain/config.toml
+--- firefox-113.0.1/supply-chain/config.toml.D178251 2023-05-12 00:09:23.000000000 +0200
++++ firefox-113.0.1/supply-chain/config.toml 2023-05-24 10:55:51.178278632 +0200
+@@ -23,6 +23,10 @@ url = "https://raw.githubusercontent.com
+ audit-as-crates-io = true
+ notes = "This is the upstream code plus a few local fixes, see bug 1685697."
+
++[policy."bindgen:0.64.0"]
++audit-as-crates-io = true
++notes = "This is a local override of the bindgen crate from crates.io, with a small local patch."
++
+ [policy.chardetng]
+ audit-as-crates-io = true
+ notes = "This is a crate Henri wrote which is also published. We should probably update Firefox to tip and certify that."
+diff -up firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs.D178251 firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs
+--- firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs.D178251 2023-05-11 23:42:49.000000000 +0200
++++ firefox-113.0.1/third_party/rust/bindgen/codegen/mod.rs 2023-05-24 10:55:51.178278632 +0200
+@@ -141,12 +141,13 @@ fn derives_of_item(
+ item: &Item,
+ ctx: &BindgenContext,
+ packed: bool,
++ forward_decl: bool,
+ ) -> DerivableTraits {
+ let mut derivable_traits = DerivableTraits::empty();
+
+ let all_template_params = item.all_template_params(ctx);
+
+- if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() {
++ if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() && !forward_decl {
+ derivable_traits |= DerivableTraits::COPY;
+
+ if ctx.options().rust_features().builtin_clone_impls ||
+@@ -991,7 +992,7 @@ impl CodeGenerator for Type {
+ vec![attributes::repr("transparent")];
+ let packed = false; // Types can't be packed in Rust.
+ let derivable_traits =
+- derives_of_item(item, ctx, packed);
++ derives_of_item(item, ctx, packed, false);
+ if !derivable_traits.is_empty() {
+ let derives: Vec<_> = derivable_traits.into();
+ attributes.push(attributes::derives(&derives))
+@@ -2032,8 +2033,9 @@ impl CodeGenerator for CompInfo {
+ }
+
+ if forward_decl {
++ let prefix = ctx.trait_prefix();
+ fields.push(quote! {
+- _unused: [u8; 0],
++ _unused: ::#prefix::cell::UnsafeCell<[u8; 0]>,
+ });
+ }
+
+@@ -2095,7 +2097,7 @@ impl CodeGenerator for CompInfo {
+ }
+ }
+
+- let derivable_traits = derives_of_item(item, ctx, packed);
++ let derivable_traits = derives_of_item(item, ctx, packed, self.is_forward_declaration());
+ if !derivable_traits.contains(DerivableTraits::DEBUG) {
+ needs_debug_impl = ctx.options().derive_debug &&
+ ctx.options().impl_debug &&
+@@ -3127,7 +3129,7 @@ impl CodeGenerator for Enum {
+
+ if !variation.is_const() {
+ let packed = false; // Enums can't be packed in Rust.
+- let mut derives = derives_of_item(item, ctx, packed);
++ let mut derives = derives_of_item(item, ctx, packed, false);
+ // For backwards compat, enums always derive
+ // Clone/Eq/PartialEq/Hash, even if we don't generate those by
+ // default.
diff --git a/firefox.spec b/firefox.spec
index a0f11f8..ed2a8e2 100644
--- a/firefox.spec
+++ b/firefox.spec
@@ -176,7 +176,7 @@ ExcludeArch: i686
Summary: Mozilla Firefox Web browser
Name: firefox
Version: 113.0.1
-Release: 3%{?pre_tag}%{?dist}
+Release: 4%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
@@ -253,6 +253,9 @@ Patch407: mozilla-1667096.patch
Patch408: mozilla-1832770.patch
# TODO: do we need it?
#Patch415: mozilla-1670333.patch
+Patch410: D177258.diff
+Patch411: D177902.diff
+Patch412: D178251.diff
# PGO/LTO patches
Patch600: pgo.patch
@@ -534,6 +537,9 @@ This package contains results of tests executed during build.
%patch408 -p1 -b .1832770
# TODO: do we need it?
#%patch415 -p1 -b .1670333
+%patch410 -p1 -b .D177258
+%patch411 -p1 -b .D177902
+%patch412 -p1 -b .D178251
# PGO patches
%if %{build_with_pgo}
@@ -1084,6 +1090,10 @@ fi
#---------------------------------------------------------------------
%changelog
+* Wed May 24 2023 Martin Stransky - 113.0.1-4
+- Added patches from 113.0.2
+- Added Rust fix for Rawhide (mzbz#1831242).
+
* Fri May 19 2023 Martin Stransky - 113.0.1-3
- Disabled libproxy support due to regressions (rhbz#2207469)