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 ReentrantScriptForbiddenScope_h | |
6 #define ReentrantScriptForbiddenScope_h | |
7 | |
8 #include "platform/PlatformExport.h" | |
9 | |
10 namespace blink { | |
11 | |
12 // Similar to ScriptForbiddenScope, but more selective. This is intended to help | |
haraken
2015/06/10 02:14:37
I don't fully understand the difference. What's an
dcheng
2015/06/10 02:18:40
ScriptForbiddenScope would block all script execut
haraken
2015/06/10 02:22:19
Makes sense. If this is a plugin-specific thing, s
dcheng
2015/06/10 03:11:03
Done.
| |
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. | |
haraken
2015/06/10 02:14:37
Great comment!
| |
39 class PLATFORM_EXPORT ReentrantScriptForbiddenScope { | |
40 public: | |
41 ReentrantScriptForbiddenScope(); | |
42 ~ReentrantScriptForbiddenScope(); | |
43 | |
44 static bool isForbidden(); | |
45 }; | |
46 | |
47 } // namespace blink | |
48 | |
49 #endif // ReentrantScriptForbiddenScope_h | |
OLD | NEW |