Index: components/error_page/common/localized_error.cc |
diff --git a/components/error_page/common/localized_error.cc b/components/error_page/common/localized_error.cc |
index 1d05b90b92b2869b9fc765af7d9d7027bcf82b45..ef5bf3c5b006634d5e0cf099ad5bda4a05ba25ec 100644 |
--- a/components/error_page/common/localized_error.cc |
+++ b/components/error_page/common/localized_error.cc |
@@ -30,6 +30,7 @@ |
#include "net/base/net_errors.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/webui/web_ui_util.h" |
+#include "url/origin.h" |
#if defined(OS_WIN) |
#include "base/win/windows_version.h" |
@@ -65,6 +66,7 @@ enum NAV_SUGGESTIONS { |
SUGGEST_COMPLETE_SETUP = 1 << 11, |
// Reload page suggestion for pages created by a post. |
SUGGEST_REPOST_RELOAD = 1 << 12, |
+ SUGGEST_NAVIGATE_TO_ORIGIN = 1 << 13, |
}; |
enum SHOW_BUTTONS { |
@@ -269,6 +271,12 @@ const LocalizedErrorMap net_error_options[] = { |
SUGGEST_DISABLE_EXTENSION, |
SHOW_BUTTON_RELOAD, |
}, |
+ {net::ERR_BLOCKED_BY_XSS_AUDITOR, |
+ IDS_ERRORPAGES_HEADING_PAGE_NOT_WORKING, |
+ IDS_ERRORPAGES_SUMMARY_BLOCKED_BY_XSS_AUDITOR, |
+ SUGGEST_NAVIGATE_TO_ORIGIN, |
+ SHOW_NO_BUTTONS, |
+ }, |
{net::ERR_NETWORK_CHANGED, |
IDS_ERRORPAGES_HEADING_CONNECTION_INTERRUPTED, |
IDS_ERRORPAGES_SUMMARY_NETWORK_CHANGED, |
@@ -614,6 +622,23 @@ void GetSuggestionsSummaryList(int error_code, |
} |
DCHECK(!IsSuggested(suggestions, SUGGEST_REPOST_RELOAD)); |
+ if (IsOnlySuggestion(suggestions, SUGGEST_NAVIGATE_TO_ORIGIN)) { |
+ DCHECK(suggestions_summary_list->empty()); |
+ DCHECK(!(suggestions & ~SUGGEST_NAVIGATE_TO_ORIGIN)); |
+ url::Origin failed_origin(failed_url); |
+ if (failed_origin.unique()) |
+ return; |
+ |
+ auto suggestion = base::MakeUnique<base::DictionaryValue>(); |
+ suggestion->SetString("summary", |
+ l10n_util::GetStringUTF16( |
+ IDS_ERRORPAGES_SUGGESTION_NAVIGATE_TO_ORIGIN)); |
+ suggestion->SetString("originURL", failed_origin.Serialize()); |
+ suggestions_summary_list->Append(std::move(suggestion)); |
+ return; |
+ } |
+ DCHECK(!IsSuggested(suggestions, SUGGEST_NAVIGATE_TO_ORIGIN)); |
+ |
if (IsOnlySuggestion(suggestions, SUGGEST_LEARNMORE)) { |
DCHECK(suggestions_summary_list->empty()); |
AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list, |