diff --git a/lib/renderer/inspector.ts b/lib/renderer/inspector.ts index 023c4ee36b..5afc958d49 100644 --- a/lib/renderer/inspector.ts +++ b/lib/renderer/inspector.ts @@ -11,12 +11,14 @@ const { contextIsolationEnabled } = internalContextBridge; * 1) Use menu API to show context menu. */ window.onload = function () { - if (contextIsolationEnabled) { - internalContextBridge.overrideGlobalValueFromIsolatedWorld([ - 'InspectorFrontendHost', 'showContextMenuAtPoint' - ], createMenu); - } else { - window.InspectorFrontendHost!.showContextMenuAtPoint = createMenu; + if (window.InspectorFrontendHost) { + if (contextIsolationEnabled) { + internalContextBridge.overrideGlobalValueFromIsolatedWorld([ + 'InspectorFrontendHost', 'showContextMenuAtPoint' + ], createMenu); + } else { + window.InspectorFrontendHost.showContextMenuAtPoint = createMenu; + } } }; diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc index 343fa0e70b..e9c48ef4fb 100644 --- a/shell/renderer/api/electron_api_context_bridge.cc +++ b/shell/renderer/api/electron_api_context_bridge.cc @@ -830,7 +830,9 @@ gin_helper::Dictionary TraceKeyPath(const gin_helper::Dictionary& start, const std::vector& key_path) { gin_helper::Dictionary current = start; for (size_t i = 0; i < key_path.size() - 1; i++) { - CHECK(current.Get(key_path[i], ¤t)); + CHECK(current.Get(key_path[i], ¤t)) + << "Failed to get property '" << key_path[i] << "' at index " << i + << " in key path"; } return current; }