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

Unified Diff: Source/bindings/core/v8/V8DOMConfiguration.h

Issue 413393003: Blink-in-JS: Implement internal APIs exposed only to private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/V8DOMConfiguration.h
diff --git a/Source/bindings/core/v8/V8DOMConfiguration.h b/Source/bindings/core/v8/V8DOMConfiguration.h
index 62fa6751fc356dec0dc58550429eacb1224ac4f5..d2214261a2b135173c035e870267768806c74659 100644
--- a/Source/bindings/core/v8/V8DOMConfiguration.h
+++ b/Source/bindings/core/v8/V8DOMConfiguration.h
@@ -43,6 +43,11 @@ public:
// reduces the binary size by moving from code driven setup to data table
// driven setup.
+ enum ExposeConfiguration {
+ ExposedToAllScripts,
+ OnlyExposedToPrivateScript,
+ };
+
// AttributeConfiguration translates into calls to SetAccessor() on either
// the instance or the prototype ObjectTemplate, based on |onPrototype|.
struct AttributeConfiguration {
@@ -54,6 +59,7 @@ public:
const WrapperTypeInfo* data;
v8::AccessControl settings;
v8::PropertyAttribute attribute;
+ ExposeConfiguration exposeConfiguration;
bool onPrototype;
};
@@ -68,6 +74,7 @@ public:
const WrapperTypeInfo* data;
v8::AccessControl settings;
v8::PropertyAttribute attribute;
+ ExposeConfiguration exposeConfiguration;
};
static void installAttributes(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::ObjectTemplate>, const AttributeConfiguration*, size_t attributeCount, v8::Isolate*);
@@ -75,9 +82,13 @@ public:
template<class ObjectOrTemplate>
static inline void installAttribute(v8::Handle<ObjectOrTemplate> instanceTemplate, v8::Handle<ObjectOrTemplate> prototype, const AttributeConfiguration& attribute, v8::Isolate* isolate)
{
+ DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
+ if (attribute.exposeConfiguration == OnlyExposedToPrivateScript && !world.isPrivateScriptIsolatedWorld())
+ return;
+
v8::AccessorGetterCallback getter = attribute.getter;
v8::AccessorSetterCallback setter = attribute.setter;
- if (DOMWrapperWorld::current(isolate).isMainWorld()) {
+ if (world.isMainWorld()) {
if (attribute.getterForMainWorld)
getter = attribute.getterForMainWorld;
if (attribute.setterForMainWorld)
@@ -122,6 +133,7 @@ public:
v8::FunctionCallback callback;
v8::FunctionCallback callbackForMainWorld;
int length;
+ ExposeConfiguration exposeConfiguration;
};
static void installMethods(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Signature>, v8::PropertyAttribute, const MethodConfiguration*, size_t callbackCount, v8::Isolate*);
« no previous file with comments | « LayoutTests/fast/dom/private_script_unittest-expected.txt ('k') | Source/bindings/core/v8/V8DOMConfiguration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698