Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2940)

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 304313003: Allow view-source of pages fully-blocked by Blink's XSS filter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove stray debugging include. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index e2225bac044e306c1e8450572c8abddec57518b6..43e13e01699588b5ad58399708010ebdf85ff69f 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -1144,6 +1144,19 @@ void ViewSource(Browser* browser, WebContents* contents) {
if (!entry)
return;
+ // If blink sent us to its blocked-page URL, show the source of the previous
+ // page (which generated the block) instead.
+ if (entry->GetURL() == GURL("data:,Blocked")) {
+ NavigationEntry* previous = contents->GetController().GetEntryAtOffset(-1);
+ if (previous) {
+ base::string16 value;
+ if (previous->GetExtraData("XSSDetected", &value) &&
+ value == base::ASCIIToUTF16("1")) {
+ entry = previous;
+ }
+ }
+ }
+
ViewSource(browser, contents, entry->GetURL(), entry->GetPageState());
}
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.h » ('j') | content/browser/web_contents/web_contents_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698