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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 1172143004: Block scripting in plugin teardown during Document unload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restrict the legacy PP_Var too Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/pepper/ppb_var_deprecated_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 #include "third_party/WebKit/public/platform/WebURL.h" 103 #include "third_party/WebKit/public/platform/WebURL.h"
104 #include "third_party/WebKit/public/platform/WebURLError.h" 104 #include "third_party/WebKit/public/platform/WebURLError.h"
105 #include "third_party/WebKit/public/platform/WebURLRequest.h" 105 #include "third_party/WebKit/public/platform/WebURLRequest.h"
106 #include "third_party/WebKit/public/web/WebBindings.h" 106 #include "third_party/WebKit/public/web/WebBindings.h"
107 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 107 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
108 #include "third_party/WebKit/public/web/WebDataSource.h" 108 #include "third_party/WebKit/public/web/WebDataSource.h"
109 #include "third_party/WebKit/public/web/WebDocument.h" 109 #include "third_party/WebKit/public/web/WebDocument.h"
110 #include "third_party/WebKit/public/web/WebInputEvent.h" 110 #include "third_party/WebKit/public/web/WebInputEvent.h"
111 #include "third_party/WebKit/public/web/WebLocalFrame.h" 111 #include "third_party/WebKit/public/web/WebLocalFrame.h"
112 #include "third_party/WebKit/public/web/WebPluginContainer.h" 112 #include "third_party/WebKit/public/web/WebPluginContainer.h"
113 #include "third_party/WebKit/public/web/WebPluginScriptForbiddenScope.h"
113 #include "third_party/WebKit/public/web/WebPrintParams.h" 114 #include "third_party/WebKit/public/web/WebPrintParams.h"
114 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" 115 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
115 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 116 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
116 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 117 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
117 #include "third_party/WebKit/public/web/WebScriptSource.h" 118 #include "third_party/WebKit/public/web/WebScriptSource.h"
118 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 119 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
119 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 120 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
120 #include "third_party/WebKit/public/web/WebView.h" 121 #include "third_party/WebKit/public/web/WebView.h"
121 #include "third_party/khronos/GLES2/gl2.h" 122 #include "third_party/khronos/GLES2/gl2.h"
122 #include "ui/gfx/image/image_skia.h" 123 #include "ui/gfx/image/image_skia.h"
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 ScopedPPVar result = try_catch.FromV8(container_->v8ObjectForElement()); 2365 ScopedPPVar result = try_catch.FromV8(container_->v8ObjectForElement());
2365 DCHECK(!try_catch.HasException()); 2366 DCHECK(!try_catch.HasException());
2366 return result.Release(); 2367 return result.Release();
2367 } 2368 }
2368 2369
2369 PP_Var PepperPluginInstanceImpl::ExecuteScript(PP_Instance instance, 2370 PP_Var PepperPluginInstanceImpl::ExecuteScript(PP_Instance instance,
2370 PP_Var script_var, 2371 PP_Var script_var,
2371 PP_Var* exception) { 2372 PP_Var* exception) {
2372 if (!container_) 2373 if (!container_)
2373 return PP_MakeUndefined(); 2374 return PP_MakeUndefined();
2375 if (is_deleted_ && blink::WebPluginScriptForbiddenScope::isForbidden())
2376 return PP_MakeUndefined();
2374 RecordFlashJavaScriptUse(); 2377 RecordFlashJavaScriptUse();
2375 2378
2376 // Executing the script may remove the plugin from the DOM, so we need to keep 2379 // Executing the script may remove the plugin from the DOM, so we need to keep
2377 // a reference to ourselves so that we can still process the result after the 2380 // a reference to ourselves so that we can still process the result after the
2378 // WebBindings::evaluate() below. 2381 // WebBindings::evaluate() below.
2379 scoped_refptr<PepperPluginInstanceImpl> ref(this); 2382 scoped_refptr<PepperPluginInstanceImpl> ref(this);
2380 V8VarConverter converter(pp_instance_, V8VarConverter::kAllowObjectVars); 2383 V8VarConverter converter(pp_instance_, V8VarConverter::kAllowObjectVars);
2381 PepperTryCatchVar try_catch(this, &converter, exception); 2384 PepperTryCatchVar try_catch(this, &converter, exception);
2382 2385
2383 // Check for an exception due to the context being destroyed. 2386 // Check for an exception due to the context being destroyed.
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3304 3307
3305 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() { 3308 void PepperPluginInstanceImpl::RecordFlashJavaScriptUse() {
3306 if (initialized_ && !javascript_used_ && is_flash_plugin_) { 3309 if (initialized_ && !javascript_used_ && is_flash_plugin_) {
3307 javascript_used_ = true; 3310 javascript_used_ = true;
3308 RenderThread::Get()->RecordAction( 3311 RenderThread::Get()->RecordAction(
3309 base::UserMetricsAction("Flash.JavaScriptUsed")); 3312 base::UserMetricsAction("Flash.JavaScriptUsed"));
3310 } 3313 }
3311 } 3314 }
3312 3315
3313 } // namespace content 3316 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/ppb_var_deprecated_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698