Skip to content

Commit 42ff92a

Browse files
author
Adam Cozzette
authored
Merge pull request #9166 from acozzette/cherry-pick-fixes
Cherry-pick fixes for 3.19.1 and update change log
2 parents c7dfd0d + 1c8ae24 commit 42ff92a

4 files changed

Lines changed: 25 additions & 3 deletions

File tree

CHANGES.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
2+
3+
Bazel
4+
* Ensure that release archives contain everything needed for Bazel (#9131)
5+
* Align dependency handling with Bazel best practices (#9165)
6+
7+
JavaScript
8+
* Fix `ReferenceError: window is not defined` when getting the global object (#9156)
9+
10+
Ruby
11+
* Fix memory leak in MessageClass.encode (#9150)
12+
113
2021-10-15 version 3.19.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
214

315
C++
@@ -17,6 +29,7 @@
1729

1830
Kotlin
1931
* Switch Kotlin proto DSLs to be implemented with inline value classes
32+
* Fix inlining and deprecation for repeated string fields in kotlin (#9120)
2033

2134
Python
2235
* Proto2 DecodeError now includes message name in error message
@@ -37,6 +50,7 @@
3750
* Add class method Timestamp.from_time to ruby well known types (#8562)
3851
* Adopt pure ruby DSL implementation for JRuby (#9047)
3952
* Add size to Map class (#8068)
53+
* Fix for descriptor_pb.rb: google/protobuf should be required first (#9121)
4054

4155
C#
4256
* Correctly set ExtensionRegistry when parsing with MessageParser, but using an already existing CodedInputStream (#7246)

php/ext/google/protobuf/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</stability>
2323
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
2424
<notes>
25-
* Added &quot;object&quot; as a reserved name (#8962)
25+
* No new changes in 3.19.1
2626
</notes>
2727
<contents>
2828
<dir baseinstalldir="/" name="/">

ruby/ext/google/protobuf_c/message.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,14 +1012,15 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
10121012
*/
10131013
static VALUE Message_encode(VALUE klass, VALUE msg_rb) {
10141014
Message* msg = ruby_to_Message(msg_rb);
1015-
upb_arena *arena = upb_arena_new();
10161015
const char *data;
10171016
size_t size;
10181017

10191018
if (CLASS_OF(msg_rb) != klass) {
10201019
rb_raise(rb_eArgError, "Message of wrong type.");
10211020
}
10221021

1022+
upb_arena *arena = upb_arena_new();
1023+
10231024
data = upb_encode(msg->msg, upb_msgdef_layout(msg->msgdef), arena,
10241025
&size);
10251026

src/google/protobuf/compiler/js/js_generator.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3634,7 +3634,14 @@ void Generator::GenerateFile(const GeneratorOptions& options,
36343634
// - self: defined inside Web Workers (WorkerGlobalScope)
36353635
// - Function('return this')(): this will work on most platforms, but it may be blocked by things like CSP.
36363636
// Function('') is almost the same as eval('')
3637-
printer->Print("var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);\n\n");
3637+
printer->Print(
3638+
"var global = (function() {\n"
3639+
" if (this) { return this; }\n"
3640+
" if (typeof window !== 'undefined') { return window; }\n"
3641+
" if (typeof global !== 'undefined') { return global; }\n"
3642+
" if (typeof self !== 'undefined') { return self; }\n"
3643+
" return Function('return this')();\n"
3644+
"}.call(null));\n\n");
36383645
}
36393646

36403647
for (int i = 0; i < file->dependency_count(); i++) {

0 commit comments

Comments
 (0)