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

Unified Diff: chrome/renderer/render_view.cc

Issue 351013: Chrome changes to extract the code from V8Proxy that special-cases... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/renderer_glue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 30634)
+++ chrome/renderer/render_view.cc (working copy)
@@ -2422,6 +2422,31 @@
origin.toString().utf8()));
}
+bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) {
+ if (enabled_per_settings)
+ return true;
+
+ WebSecurityOrigin origin = frame->securityOrigin();
+ if (origin.isEmpty())
+ return false; // Uninitialized document?
+
+ if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme))
+ return true; // Browser UI elements should still work.
+
+ // If the scheme is ftp: or file:, an empty file name indicates a directory
+ // listing, which requires JavaScript to function properly.
+ GURL frame_url = frame->url();
+ const char* kDirProtocols[] = { "ftp", "file" };
+ for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
+ if (EqualsASCII(origin.protocol(), kDirProtocols[i])) {
+ return frame_url.SchemeIs(kDirProtocols[i]) &&
+ frame_url.ExtractFileName().empty();
+ }
+ }
+
+ return false; // Other protocols fall through here.
+}
+
void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) {
Send(new ViewHostMsg_JSOutOfMemory(routing_id_));
}
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/renderer_glue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698