Skip to content

Commit b04c450

Browse files
fix: correct electron gin embedder indices (#45880)
fix: correct gin embedder indices. Move electron extra embedders to the end of the enum so they do not interfere with chromium embedders indices. Also use kEmbedderBlinkTag directly in its index calculation without adding extra indices from other tags. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Marek Haranczyk <[email protected]>
1 parent c3fd3af commit b04c450

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ diff --git a/gin/public/gin_embedders.h b/gin/public/gin_embedders.h
4343
index 8d7c5631fd8f1499c67384286f0e3c4037673b32..99b2e2f63be8a46c5546dd53bc9b05e8c54e857c 100644
4444
--- a/gin/public/gin_embedders.h
4545
+++ b/gin/public/gin_embedders.h
46-
@@ -18,6 +18,8 @@ namespace gin {
47-
enum GinEmbedder : uint16_t {
48-
kEmbedderNativeGin,
46+
@@ -20,6 +20,8 @@ enum GinEmbedder : uint16_t {
4947
kEmbedderBlink,
50-
+ kEmbedderElectron,
51-
+ kEmbedderBlinkTag,
5248
kEmbedderPDFium,
5349
kEmbedderFuchsia,
50+
+ kEmbedderElectron,
51+
+ kEmbedderBlinkTag,
5452
};
53+
54+
} // namespace gin
5555
diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc
5656
index e4a27a24c83dd1a478b2ada8b6c8220076790791..c76dc818f38a62fff63852dbecbc85e304ac731d 100644
5757
--- a/third_party/blink/renderer/platform/bindings/script_state.cc
@@ -112,14 +112,13 @@ index b3cc8d819b06108386aed9465cab4f27a28b675f..a1757901e52360a9c2ec3c573adb20d0
112112
static constexpr int kV8ContextPerContextDataIndex =
113113
static_cast<int>(gin::kPerContextDataStartIndex) +
114114
static_cast<int>(gin::kEmbedderBlink);
115-
@@ -271,6 +278,11 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
115+
@@ -271,6 +278,10 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
116116
// internals.idl.
117117
String last_compiled_script_file_name_;
118118
bool last_compiled_script_used_code_cache_ = false;
119119
+
120120
+ static constexpr int kV8ContextPerContextDataTagIndex =
121121
+ static_cast<int>(gin::kPerContextDataStartIndex) +
122-
+ static_cast<int>(gin::kEmbedderBlink) +
123122
+ static_cast<int>(gin::kEmbedderBlinkTag);
124123
};
125124

0 commit comments

Comments
 (0)