fix: potential devtools crash on empty (#49489)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2026-01-22 11:59:57 -05:00
committed by GitHub
parent 7784d25821
commit 6ce52ad792
2 changed files with 11 additions and 7 deletions

View File

@@ -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;
}
}
};

View File

@@ -833,7 +833,9 @@ gin_helper::Dictionary TraceKeyPath(const gin_helper::Dictionary& start,
const std::vector<std::string>& key_path) {
gin_helper::Dictionary current = start;
for (size_t i = 0; i < key_path.size() - 1; i++) {
CHECK(current.Get(key_path[i], &current));
CHECK(current.Get(key_path[i], &current))
<< "Failed to get property '" << key_path[i] << "' at index " << i
<< " in key path";
}
return current;
}