OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PluginScriptForbiddenScope_h |
| 6 #define PluginScriptForbiddenScope_h |
| 7 |
| 8 #include "platform/PlatformExport.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 // Similar to ScriptForbiddenScope, but more selective. This is intended to help |
| 13 // reduce the number of places where Flash can run a nested message loop as its |
| 14 // plugin element is being destroyed. One of the reasons that Flash runs this |
| 15 // nested message loop is to allow Flash content to synchronously script the |
| 16 // page when the plugin element is destroyed. |
| 17 // |
| 18 // This is problematic for many reasons: the DOM may not be in a consistent |
| 19 // state, since Blink is in the middle of detaching nodes, nested message loops |
| 20 // can cause normally impossible conditions to occur (https://crbug.com/367210), |
| 21 // etc. |
| 22 // |
| 23 // When this object is instantiated on the stack, it allows execution of event |
| 24 // handlers, etc but blocks attempts by plugins to call back into Blink to |
| 25 // execute script. |
| 26 // |
| 27 // Background: |
| 28 // For historical reasons, Flash has allowed synchronous scripting during |
| 29 // teardown of the plugin. This is generally problematic, but sites apparently |
| 30 // rely on this behavior. Over time, Blink has added restrictions on this |
| 31 // synchronous scripting: for example, past a certain point in Frame detach, |
| 32 // script execution by Flash is ignored: https://crbug.com/371084. |
| 33 // |
| 34 // Unfortunately, there are still ways for plugins to synchronously script |
| 35 // during Document detach: if an unload handler removes a Flash plugin element, |
| 36 // that will run the nested message loop, etc. This scoper is intended to block |
| 37 // those usages, with the eventual goal that Frame detach will never have to run |
| 38 // a nested message loop. |
| 39 class PLATFORM_EXPORT PluginScriptForbiddenScope { |
| 40 public: |
| 41 PluginScriptForbiddenScope(); |
| 42 ~PluginScriptForbiddenScope(); |
| 43 |
| 44 static bool isForbidden(); |
| 45 }; |
| 46 |
| 47 } // namespace blink |
| 48 |
| 49 #endif // PluginScriptForbiddenScope_h |
OLD | NEW |