Index: Source/bindings/core/v8/ScriptController.h |
diff --git a/Source/bindings/core/v8/ScriptController.h b/Source/bindings/core/v8/ScriptController.h |
index 931275d5dcc4d264063616ee006d2bceb5ae7b8d..e8120e94f205ec7a1bf8c7b494554d3ef94ea711 100644 |
--- a/Source/bindings/core/v8/ScriptController.h |
+++ b/Source/bindings/core/v8/ScriptController.h |
@@ -38,6 +38,7 @@ |
#include "wtf/Forward.h" |
#include "wtf/HashMap.h" |
#include "wtf/RefCounted.h" |
+#include "wtf/TemporaryChange.h" |
#include "wtf/Vector.h" |
#include "wtf/text/TextPosition.h" |
#include <v8.h> |
@@ -105,6 +106,8 @@ public: |
// Returns true if the current world is isolated, and has its own Content |
// Security Policy. In this case, the policy of the main world should be |
// ignored when evaluating resources injected into the DOM. |
+ // Alternatively, this can be explicitly forced to true within a scope |
+ // using BypassMainWorldCSP. |
bool shouldBypassMainWorldCSP(); |
// Creates a property of the global object of a frame. |
@@ -149,6 +152,15 @@ public: |
v8::Isolate* isolate() const { return m_isolate; } |
+ class BypassMainWorldCSP : public TemporaryChange<bool> { |
haraken
2014/09/01 00:59:43
The idea of introducing BypassMainWorldCSP looks g
jbroman
2014/09/02 15:44:04
The friend class is there to keep m_bypassMainWorl
|
+ public: |
+ BypassMainWorldCSP(ScriptController& controller) |
+ : TemporaryChange<bool>(controller.m_bypassMainWorldCSP, true) |
+ { |
+ } |
+ }; |
+ friend class BypassMainWorldCSP; |
+ |
private: |
typedef HashMap<int, OwnPtr<WindowProxy> > IsolatedWorldMap; |
typedef HashMap<Widget*, NPObject*> PluginObjectMap; |
@@ -169,6 +181,8 @@ private: |
PluginObjectMap m_pluginObjects; |
NPObject* m_windowScriptNPObject; |
+ |
+ bool m_bypassMainWorldCSP; |
}; |
} // namespace blink |