alloy: Fix link click navigation in PDF files (fixes issue #3143)

This change adds a minimal implementation of the |tabs.update| extension API and
modifies StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent to return a valid
|streamInfo.tabId| value as required by the navigateInCurrentTab implementation
in chrome/browser/resources/pdf/browser_api.js.
This commit is contained in:
Marshall Greenblatt
2021-06-16 15:54:26 -04:00
parent 1d02cd2be0
commit de66fb9406
8 changed files with 265 additions and 33 deletions

View File

@ -318,24 +318,12 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
GURL url;
if (params.url.get()) {
std::string url_string = *params.url;
url = ExtensionTabUtil::ResolvePossiblyRelativeURL(url_string,
function()->extension());
if (!url.is_valid()) {
if (error_message) {
*error_message =
ErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, url_string);
}
if (!ExtensionTabUtil::PrepareURLForNavigation(
url_string, function()->extension(), &url, error_message)) {
return nullptr;
}
}
// Don't let extensions crash the browser or renderers.
if (ExtensionTabUtil::IsKillURL(url)) {
if (error_message)
*error_message = keys::kNoCrashBrowserError;
return nullptr;
}
// Default to foreground for the new tab. The presence of 'active' property
// will override this default.
bool active = true;