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

Unified Diff: extensions/renderer/user_script_set.cc

Issue 1018163002: [Extensions] Skip injecting scripts into remote frames with site isolation turned on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/user_script_set.cc
diff --git a/extensions/renderer/user_script_set.cc b/extensions/renderer/user_script_set.cc
index f82465d6f1992e70edfedc53266935839c07b5ba..819c6308ff8cf498cff9b8ada853e7071d65c3c6 100644
--- a/extensions/renderer/user_script_set.cc
+++ b/extensions/renderer/user_script_set.cc
@@ -204,11 +204,18 @@ scoped_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript(
scoped_ptr<ScriptInjector> injector(new UserScriptInjector(script,
this,
is_declarative));
- if (injector->CanExecuteOnFrame(
- injection_host.get(),
- web_frame,
- -1, // Content scripts are not tab-specific.
- web_frame->top()->document().url()) ==
+
+ blink::WebDocument top_document = web_frame->top()->document();
Devlin 2015/03/18 22:49:31 nit: This seems like it should be one of the first
Devlin 2015/03/18 22:50:47 (I'll defer to nasko that this is a suitable diffe
not at google - send to devlin 2015/03/18 22:54:54 Another check would be to see if the top frame is
not at google - send to devlin 2015/03/18 22:54:54 It's a hack, and the least interesting check here
nasko 2015/03/19 17:33:48 Remote frames cannot host any documents or content
+ // This can be null if site isolation is turned on. The best we can do is to
+ // just give up - generally the wrong behavior, but better than crashing.
+ // TODO(kalman): Fix this properly by moving all security checks into the
+ // browser. See http://crbug.com/466373 for ongoing work here.
+ if (top_document.isNull())
+ return injection.Pass();
+
+ if (injector->CanExecuteOnFrame(injection_host.get(), web_frame,
+ -1, // Content scripts are not tab-specific.
+ top_document.url()) ==
PermissionsData::ACCESS_DENIED) {
return injection.Pass();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698