summaryrefslogtreecommitdiff
path: root/chromium/components/error_page
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-05 14:08:31 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-04-11 07:46:53 +0000
commit6a4cabb866f66d4128a97cdc6d9d08ce074f1247 (patch)
treeab00f70a5e89278d6a0d16ff0c42578dc4d84a2d /chromium/components/error_page
parente733310db58160074f574c429d48f8308c0afe17 (diff)
downloadqtwebengine-chromium-6a4cabb866f66d4128a97cdc6d9d08ce074f1247.tar.gz
BASELINE: Update Chromium to 57.0.2987.144
Change-Id: I29db402ff696c71a04c4dbaec822c2e53efe0267 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'chromium/components/error_page')
-rw-r--r--chromium/components/error_page/common/BUILD.gn2
-rw-r--r--chromium/components/error_page/common/localized_error.cc40
-rw-r--r--chromium/components/error_page/renderer/net_error_helper_core.cc14
-rw-r--r--chromium/components/error_page/renderer/net_error_helper_core.h7
-rw-r--r--chromium/components/error_page/renderer/net_error_helper_core_unittest.cc2
5 files changed, 52 insertions, 13 deletions
diff --git a/chromium/components/error_page/common/BUILD.gn b/chromium/components/error_page/common/BUILD.gn
index 98cd30dbe1c..16eaa845971 100644
--- a/chromium/components/error_page/common/BUILD.gn
+++ b/chromium/components/error_page/common/BUILD.gn
@@ -17,7 +17,7 @@ static_library("common") {
deps = [
"//base",
"//base:i18n",
- "//components/offline_pages:switches",
+ "//components/offline_pages/core:switches",
"//components/strings",
"//components/url_formatter",
"//net",
diff --git a/chromium/components/error_page/common/localized_error.cc b/chromium/components/error_page/common/localized_error.cc
index 825a9d80461..5192a110541 100644
--- a/chromium/components/error_page/common/localized_error.cc
+++ b/chromium/components/error_page/common/localized_error.cc
@@ -30,13 +30,14 @@
#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"
#endif
#if defined(OS_ANDROID)
-#include "components/offline_pages/offline_page_feature.h"
+#include "components/offline_pages/core/offline_page_feature.h"
#endif
namespace error_page {
@@ -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 {
@@ -82,6 +84,7 @@ struct LocalizedErrorMap {
int buttons; // Which buttons if any to show.
};
+// clang-format off
const LocalizedErrorMap net_error_options[] = {
{net::ERR_TIMED_OUT,
IDS_ERRORPAGES_HEADING_NOT_AVAILABLE,
@@ -269,6 +272,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,
@@ -305,7 +314,14 @@ const LocalizedErrorMap net_error_options[] = {
SUGGEST_NONE,
SHOW_NO_BUTTONS,
},
+ {net::ERR_BLOCKED_BY_RESPONSE,
+ IDS_ERRORPAGES_HEADING_BLOCKED,
+ IDS_ERRORPAGES_SUMMARY_CONNECTION_REFUSED,
+ SUGGEST_NONE,
+ SHOW_NO_BUTTONS
+ },
};
+// clang-format on
// Special error page to be used in the case of navigating back to a page
// generated by a POST. LocalizedError::HasStrings expects this net error code
@@ -614,6 +630,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,
@@ -1004,8 +1037,9 @@ void LocalizedError::GetStrings(
}
#if defined(OS_ANDROID)
- if (!reload_visible && !show_saved_copy_visible && !is_incognito &&
- failed_url.is_valid() && failed_url.SchemeIsHTTPOrHTTPS() &&
+ if (!is_post && !reload_visible && !show_saved_copy_visible &&
+ !is_incognito && failed_url.is_valid() &&
+ failed_url.SchemeIsHTTPOrHTTPS() &&
offline_pages::IsOfflinePagesAsyncDownloadEnabled()) {
std::unique_ptr<base::DictionaryValue> download_button =
base::MakeUnique<base::DictionaryValue>();
diff --git a/chromium/components/error_page/renderer/net_error_helper_core.cc b/chromium/components/error_page/renderer/net_error_helper_core.cc
index 3b90182b743..f040f97f3d8 100644
--- a/chromium/components/error_page/renderer/net_error_helper_core.cc
+++ b/chromium/components/error_page/renderer/net_error_helper_core.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -20,7 +21,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_vector.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/strings/string16.h"
@@ -103,7 +103,7 @@ struct NavigationCorrection {
struct NavigationCorrectionResponse {
std::string event_id;
std::string fingerprint;
- ScopedVector<NavigationCorrection> corrections;
+ std::vector<std::unique_ptr<NavigationCorrection>> corrections;
static void RegisterJSONConverter(
base::JSONValueConverter<NavigationCorrectionResponse>* converter) {
@@ -302,9 +302,8 @@ std::unique_ptr<ErrorPageParams> CreateErrorPageParams(
std::unique_ptr<ErrorPageParams> params(new ErrorPageParams());
params->override_suggestions.reset(new base::ListValue());
std::unique_ptr<base::ListValue> parsed_corrections(new base::ListValue());
- for (ScopedVector<NavigationCorrection>::const_iterator it =
- response.corrections.begin();
- it != response.corrections.end(); ++it) {
+ for (auto it = response.corrections.begin(); it != response.corrections.end();
+ ++it) {
// Doesn't seem like a good idea to show these.
if ((*it)->is_porn || (*it)->is_soft_porn)
continue;
@@ -497,6 +496,8 @@ bool NetErrorHelperCore::IsReloadableError(
// handshake_failure alert.
// https://crbug.com/431387
info.error.reason != net::ERR_SSL_PROTOCOL_ERROR &&
+ // Do not trigger for XSS Auditor violations.
+ info.error.reason != net::ERR_BLOCKED_BY_XSS_AUDITOR &&
!info.was_failed_post &&
// Don't auto-reload non-http/https schemas.
// https://crbug.com/471713
@@ -656,6 +657,9 @@ void NetErrorHelperCore::OnFinishLoad(FrameType frame_type) {
RecordEvent(NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_SHOWN);
}
+ delegate_->SetIsShowingDownloadButton(
+ committed_error_page_info_->download_button_in_page);
+
delegate_->EnablePageHelperFunctions();
if (committed_error_page_info_->needs_load_navigation_corrections) {
diff --git a/chromium/components/error_page/renderer/net_error_helper_core.h b/chromium/components/error_page/renderer/net_error_helper_core.h
index 1551553e9ff..57d51941b01 100644
--- a/chromium/components/error_page/renderer/net_error_helper_core.h
+++ b/chromium/components/error_page/renderer/net_error_helper_core.h
@@ -15,10 +15,6 @@
#include "components/error_page/common/net_error_info.h"
#include "url/gurl.h"
-namespace base {
-class ListValue;
-}
-
namespace blink {
struct WebURLError;
}
@@ -114,6 +110,9 @@ class NetErrorHelperCore {
// Schedule to download the page at a later time.
virtual void DownloadPageLater() = 0;
+ // Inform that download button is being shown in the error page.
+ virtual void SetIsShowingDownloadButton(bool show) = 0;
+
protected:
virtual ~Delegate() {}
};
diff --git a/chromium/components/error_page/renderer/net_error_helper_core_unittest.cc b/chromium/components/error_page/renderer/net_error_helper_core_unittest.cc
index 79d84d68691..db07d6862e2 100644
--- a/chromium/components/error_page/renderer/net_error_helper_core_unittest.cc
+++ b/chromium/components/error_page/renderer/net_error_helper_core_unittest.cc
@@ -435,6 +435,8 @@ class NetErrorHelperCoreTest : public testing::Test,
download_count_++;
}
+ void SetIsShowingDownloadButton(bool show) override {}
+
void SendTrackingRequest(const GURL& tracking_url,
const std::string& tracking_request_body) override {
last_tracking_url_ = tracking_url;