Commit a850668c authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[d8] Fix a crash when getting the worker's onmessage handler

Bug: chromium:1162473
Change-Id: Ided2f52882aaf02e1dc9a8d0ba883fedf029464d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2663004Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72473}
parent 1c6e7920
...@@ -3547,12 +3547,11 @@ void Worker::ProcessMessage(std::unique_ptr<SerializationData> data) { ...@@ -3547,12 +3547,11 @@ void Worker::ProcessMessage(std::unique_ptr<SerializationData> data) {
Local<Object> global = context->Global(); Local<Object> global = context->Global();
// Get the message handler. // Get the message handler.
Local<Value> onmessage = global MaybeLocal<Value> maybe_onmessage = global->Get(
->Get(context, String::NewFromUtf8Literal( context, String::NewFromUtf8Literal(isolate_, "onmessage",
isolate_, "onmessage", NewStringType::kInternalized));
NewStringType::kInternalized)) Local<Value> onmessage;
.ToLocalChecked(); if (!maybe_onmessage.ToLocal(&onmessage) || !onmessage->IsFunction()) {
if (!onmessage->IsFunction()) {
return; return;
} }
Local<Function> onmessage_fun = onmessage.As<Function>(); Local<Function> onmessage_fun = onmessage.As<Function>();
......
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const script = `__proto__ = Realm.global(Realm.create());`;
const w = new Worker(script, {type : 'string'});
w.postMessage('hi');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment