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

Side by Side Diff: chrome/renderer/extensions/user_script_scheduler.cc

Issue 10863002: Added check to prevent extensions from injecting scrips into other extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added test cases for self injection... and failed injection attempt Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/extensions/user_script_scheduler.h" 5 #include "chrome/renderer/extensions/user_script_scheduler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/common/extensions/extension_error_utils.h" 9 #include "chrome/common/extensions/extension_error_utils.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // with navigation. 167 // with navigation.
168 // 168 //
169 // But different frames can have different URLs, and the extension might 169 // But different frames can have different URLs, and the extension might
170 // only have access to a subset of them. For the top frame, we can 170 // only have access to a subset of them. For the top frame, we can
171 // immediately send an error and stop because the browser process 171 // immediately send an error and stop because the browser process
172 // considers that an error too. 172 // considers that an error too.
173 // 173 //
174 // For child frames, we just skip ones the extension doesn't have access 174 // For child frames, we just skip ones the extension doesn't have access
175 // to and carry on. 175 // to and carry on.
176 if (!extension->CanExecuteScriptOnPage(frame->document().url(), 176 if (!extension->CanExecuteScriptOnPage(frame->document().url(),
177 frame_->document().url(),
177 extension_helper->tab_id(), 178 extension_helper->tab_id(),
abarth-chromium 2012/08/22 00:54:19 Having frame and frame_ be different variables is
zel 2012/08/22 01:39:20 Done.
178 NULL, 179 NULL,
179 NULL)) { 180 NULL)) {
180 if (frame->parent()) { 181 if (frame->parent()) {
181 continue; 182 continue;
182 } else { 183 } else {
183 render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished( 184 render_view->Send(new ExtensionHostMsg_ExecuteCodeFinished(
184 render_view->GetRoutingID(), 185 render_view->GetRoutingID(),
185 params.request_id, 186 params.request_id,
186 ExtensionErrorUtils::FormatErrorMessage( 187 ExtensionErrorUtils::FormatErrorMessage(
187 extension_manifest_errors::kCannotAccessPage, 188 extension_manifest_errors::kCannotAccessPage,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 251
251 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame; 252 for (WebFrame* child_frame = parent_frame->firstChild(); child_frame;
252 child_frame = child_frame->nextSibling()) { 253 child_frame = child_frame->nextSibling()) {
253 frames_vector->push_back(child_frame); 254 frames_vector->push_back(child_frame);
254 GetAllChildFrames(child_frame, frames_vector); 255 GetAllChildFrames(child_frame, frames_vector);
255 } 256 }
256 return true; 257 return true;
257 } 258 }
258 259
259 } // namespace extensions 260 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698