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

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: Add Unit Test. Created 6 years, 6 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 38cff6b408d594efa8b93cd183bc8a836b59002f..6017408214e959aad70314bbd632150a7098a2ee 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -1142,6 +1142,14 @@ void ViewSource(Browser* browser, WebContents* contents) {
if (!entry)
return;
+ // A "data:," URL may represent blink's blocked-page URL, and blink may have
+ // saved state prior to the block. Show that page instead when present.
+ if (entry->GetURL() == GURL("data:,")) {
+ NavigationEntry* blocked = contents->GetController().GetBlockedPageEntry();
+ if (blocked)
+ entry = blocked;
+ }
+
ViewSource(browser, contents, entry->GetURL(), entry->GetPageState());
}

Powered by Google App Engine
This is Rietveld 408576698