Skip to content

Commit

Permalink
Merge pull request #9166 from acozzette/cherry-pick-fixes
Browse files Browse the repository at this point in the history
Cherry-pick fixes for 3.19.1 and update change log
  • Loading branch information
acozzette authored Oct 28, 2021
2 parents c7dfd0d + 1c8ae24 commit 42ff92a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
14 changes: 14 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

Bazel
* Ensure that release archives contain everything needed for Bazel (#9131)
* Align dependency handling with Bazel best practices (#9165)

JavaScript
* Fix `ReferenceError: window is not defined` when getting the global object (#9156)

Ruby
* Fix memory leak in MessageClass.encode (#9150)

2021-10-15 version 3.19.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

C++
Expand All @@ -17,6 +29,7 @@

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

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

C#
* Correctly set ExtensionRegistry when parsing with MessageParser, but using an already existing CodedInputStream (#7246)
Expand Down
2 changes: 1 addition & 1 deletion php/ext/google/protobuf/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</stability>
<license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
<notes>
* Added &quot;object&quot; as a reserved name (#8962)
* No new changes in 3.19.1
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down
3 changes: 2 additions & 1 deletion ruby/ext/google/protobuf_c/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,14 +1012,15 @@ static VALUE Message_decode_json(int argc, VALUE* argv, VALUE klass) {
*/
static VALUE Message_encode(VALUE klass, VALUE msg_rb) {
Message* msg = ruby_to_Message(msg_rb);
upb_arena *arena = upb_arena_new();
const char *data;
size_t size;

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

upb_arena *arena = upb_arena_new();

data = upb_encode(msg->msg, upb_msgdef_layout(msg->msgdef), arena,
&size);

Expand Down
9 changes: 8 additions & 1 deletion src/google/protobuf/compiler/js/js_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3634,7 +3634,14 @@ void Generator::GenerateFile(const GeneratorOptions& options,
// - self: defined inside Web Workers (WorkerGlobalScope)
// - Function('return this')(): this will work on most platforms, but it may be blocked by things like CSP.
// Function('') is almost the same as eval('')
printer->Print("var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);\n\n");
printer->Print(
"var global = (function() {\n"
" if (this) { return this; }\n"
" if (typeof window !== 'undefined') { return window; }\n"
" if (typeof global !== 'undefined') { return global; }\n"
" if (typeof self !== 'undefined') { return self; }\n"
" return Function('return this')();\n"
"}.call(null));\n\n");
}

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

0 comments on commit 42ff92a

Please sign in to comment.