### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.

### Electron Version

11.4.6

### What operating system are you using?

Windows

### Operating System Version

Windows 10

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

The link should be opened in the current window.

### Actual Behavior

Nothing happens.

### Testcase Gist URL

https://gist.github.com/80a9108e271ca83c82cc4a8772e371fc

### Additional Information

When the PDF is loaded, try to click on the link (https://www.youtube.com/watch?v=KFPtxCDUPqs&feature=youtu.be)
shell/browser/extensions/api/tabs/tabs_api.cc
const auto& tab_id_value = list[0];
  
  int tab_id = -1;
  if (tab_id_value.is_int()) {
    
    tab_id = tab_id_value.GetInt();
    if (tab_id < 0) {
      return set_init_result(VALIDATION_FAILURE);
    }
  }
  
  const base::Value& details_value = list[1];
  if (!details_value.is_dict())
    return set_init_result(VALIDATION_FAILURE);
  std::unique_ptr<InjectDetails> details(new InjectDetails());
  if (!InjectDetails::Populate(details_value, details.get()))
    return set_init_result(VALIDATION_FAILURE);
  if (tab_id == -1) {
    
    
    
    return set_init_result(VALIDATION_FAILURE);
  }
  execute_tab_id_ = tab_id;
  details_ = std::move(details);
  set_host_id(
      mojom::HostID(mojom::HostID::HostType::kExtensions, extension()->id()));
  return set_init_result(SUCCESS);
}
bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {