Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f959cb3

Browse filesBrowse files
addaleaxtargos
authored andcommitted
worker: do not look up context twice in PostMessage
Refs: #38780 (comment) PR-URL: #38784 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent a71df76 commit f959cb3
Copy full SHA for f959cb3

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Open diff view settings
Collapse file

‎src/node_messaging.cc‎

Copy file name to clipboardExpand all lines: src/node_messaging.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,11 +840,11 @@ BaseObjectPtr<BaseObject> MessagePortData::Deserialize(
840840
}
841841

842842
Maybe<bool> MessagePort::PostMessage(Environment* env,
843+
Local<Context> context,
843844
Local<Value> message_v,
844845
const TransferList& transfer_v) {
845846
Isolate* isolate = env->isolate();
846847
Local<Object> obj = object(isolate);
847-
Local<Context> context = obj->GetCreationContext().ToLocalChecked();
848848

849849
std::shared_ptr<Message> msg = std::make_shared<Message>();
850850

@@ -986,7 +986,7 @@ void MessagePort::PostMessage(const FunctionCallbackInfo<Value>& args) {
986986
return;
987987
}
988988

989-
Maybe<bool> res = port->PostMessage(env, args[0], transfer_list);
989+
Maybe<bool> res = port->PostMessage(env, context, args[0], transfer_list);
990990
if (res.IsJust())
991991
args.GetReturnValue().Set(res.FromJust());
992992
}
Collapse file

‎src/node_messaging.h‎

Copy file name to clipboardExpand all lines: src/node_messaging.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ class MessagePort : public HandleWrap {
242242
// If this port is closed, or if there is no sibling, this message is
243243
// serialized with transfers, then silently discarded.
244244
v8::Maybe<bool> PostMessage(Environment* env,
245+
v8::Local<v8::Context> context,
245246
v8::Local<v8::Value> message,
246247
const TransferList& transfer);
247248

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.