OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef ScriptForbiddenScope_h | 5 #ifndef ScriptForbiddenScope_h |
6 #define ScriptForbiddenScope_h | 6 #define ScriptForbiddenScope_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
10 #include "wtf/TemporaryChange.h" | 10 #include "wtf/TemporaryChange.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class PLATFORM_EXPORT ScriptForbiddenScope { | 14 class PLATFORM_EXPORT ScriptForbiddenScope { |
15 public: | 15 public: |
16 ScriptForbiddenScope(); | 16 ScriptForbiddenScope(); |
17 ~ScriptForbiddenScope(); | 17 ~ScriptForbiddenScope(); |
18 | 18 |
19 class PLATFORM_EXPORT AllowUserAgentScript { | 19 class PLATFORM_EXPORT AllowUserAgentScript { |
20 public: | 20 public: |
21 AllowUserAgentScript(); | 21 AllowUserAgentScript(); |
22 ~AllowUserAgentScript(); | 22 ~AllowUserAgentScript(); |
23 private: | 23 private: |
24 TemporaryChange<unsigned> m_change; | 24 TemporaryChange<unsigned> m_change; |
25 }; | 25 }; |
26 | 26 |
27 // FIXME: This should be removed. AllowSuperUnsafeScript is used | |
28 // to exceptionally allow script execution in ScriptForbiddenScope, because | |
29 // some real-world plugins try to execute script in ScriptForbiddenScope. | |
30 // This is unsafe and we should get rid of all the unsafe script executions. | |
31 class PLATFORM_EXPORT AllowSuperUnsafeScript { | |
32 public: | |
33 AllowSuperUnsafeScript(); | |
34 ~AllowSuperUnsafeScript(); | |
35 private: | |
36 TemporaryChange<unsigned> m_change; | |
37 }; | |
38 | |
39 static void enter(); | 27 static void enter(); |
40 static void exit(); | 28 static void exit(); |
41 static bool isScriptForbidden(); | 29 static bool isScriptForbidden(); |
42 }; | 30 }; |
43 | 31 |
44 } // namespace blink | 32 } // namespace blink |
45 | 33 |
46 #endif // ScriptForbiddenScope_h | 34 #endif // ScriptForbiddenScope_h |
OLD | NEW |