summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-09-16 15:11:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-14 10:36:27 +0200
commit4443d0e27c4b989b4f8394125abc7d3170cfaf8f (patch)
tree5810fd3e28822945444cea0d293a3bd83cba3715
parent589f4fc025f608590c5a364c7f154809a2f5d2dc (diff)
Get rid of TODOs in WebChannel GIN code
The nodiscard values can be Check()ed. Pick-to: 6.2 Change-Id: I9ee38ca3404c4013c6cda6d3d0833529c2b59105 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
-rw-r--r--src/core/renderer/web_channel_ipc_transport.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp
index 8525c3619..c86888a2d 100644
--- a/src/core/renderer/web_channel_ipc_transport.cpp
+++ b/src/core/renderer/web_channel_ipc_transport.cpp
@@ -93,18 +93,15 @@ void WebChannelTransport::Install(blink::WebLocalFrame *frame, uint worldId)
gin::Handle<WebChannelTransport> transport = gin::CreateHandle(isolate, new WebChannelTransport);
v8::Local<v8::Object> global = context->Global();
- v8::MaybeLocal<v8::Value> qtObjectValue = global->Get(context, gin::StringToV8(isolate, "qt"));
+ v8::Local<v8::Value> qtObjectValue;
v8::Local<v8::Object> qtObject;
- if (qtObjectValue.IsEmpty() || !qtObjectValue.ToLocalChecked()->IsObject()) {
+ if (!global->Get(context, gin::StringToV8(isolate, "qt")).ToLocal(&qtObjectValue) || !qtObjectValue->IsObject()) {
qtObject = v8::Object::New(isolate);
- auto whocares = global->Set(context, gin::StringToV8(isolate, "qt"), qtObject);
- // FIXME: Perhaps error out, but the return value is V8 internal...
- Q_UNUSED(whocares);
+ global->Set(context, gin::StringToV8(isolate, "qt"), qtObject).Check();
} else {
- qtObject = v8::Local<v8::Object>::Cast(qtObjectValue.ToLocalChecked());
+ qtObject = v8::Local<v8::Object>::Cast(qtObjectValue);
}
- auto whocares = qtObject->Set(context, gin::StringToV8(isolate, "webChannelTransport"), transport.ToV8());
- Q_UNUSED(whocares);
+ qtObject->Set(context, gin::StringToV8(isolate, "webChannelTransport"), transport.ToV8()).Check();
}
void WebChannelTransport::Uninstall(blink::WebLocalFrame *frame, uint worldId)
@@ -119,13 +116,11 @@ void WebChannelTransport::Uninstall(blink::WebLocalFrame *frame, uint worldId)
v8::Context::Scope contextScope(context);
v8::Local<v8::Object> global(context->Global());
- v8::MaybeLocal<v8::Value> qtObjectValue = global->Get(context, gin::StringToV8(isolate, "qt"));
- if (qtObjectValue.IsEmpty() || !qtObjectValue.ToLocalChecked()->IsObject())
+ v8::Local<v8::Value> qtObjectValue;
+ if (!global->Get(context, gin::StringToV8(isolate, "qt")).ToLocal(&qtObjectValue) || !qtObjectValue->IsObject())
return;
- v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue.ToLocalChecked());
- // FIXME: We can't do anything about a failure, so why the .. is it nodiscard?
- auto whocares = qtObject->Delete(context, gin::StringToV8(isolate, "webChannelTransport"));
- Q_UNUSED(whocares);
+ v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue);
+ qtObject->Delete(context, gin::StringToV8(isolate, "webChannelTransport")).Check();
}
void WebChannelTransport::NativeQtSendMessage(gin::Arguments *args)