Title: [117732] trunk/Source/WebCore
Revision
117732
Author
[email protected]
Date
2012-05-20 23:20:01 -0700 (Sun, 20 May 2012)

Log Message

[V8] Pass Isolate to V8NPObject::npObjectGetProperty() and V8NPObject::npObjectSetProperty()
https://bugs.webkit.org/show_bug.cgi?id=86979

Reviewed by Adam Barth.

The objective is to pass Isolate around in V8 bindings.
This patch passes Isolate to V8NPObject::npObjectGetProperty()
and V8NPObject::npObjectSetProperty().

No tests. No change in behavior.

* bindings/v8/V8NPObject.cpp:
(WebCore::npObjectGetProperty):
(WebCore::npObjectNamedPropertyGetter):
(WebCore::npObjectIndexedPropertyGetter):
(WebCore::npObjectGetNamedProperty):
(WebCore::npObjectGetIndexedProperty):
(WebCore::npObjectQueryProperty):
(WebCore::npObjectSetProperty):
(WebCore::npObjectNamedPropertySetter):
(WebCore::npObjectIndexedPropertySetter):
(WebCore::npObjectSetNamedProperty):
(WebCore::npObjectSetIndexedProperty):
* bindings/v8/V8NPObject.h:
(WebCore):
* bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
(WebCore::npObjectNamedGetter):
(WebCore::npObjectNamedSetter):
(WebCore::npObjectIndexedGetter):
(WebCore::npObjectIndexedSetter):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117731 => 117732)


--- trunk/Source/WebCore/ChangeLog	2012-05-21 06:11:02 UTC (rev 117731)
+++ trunk/Source/WebCore/ChangeLog	2012-05-21 06:20:01 UTC (rev 117732)
@@ -1,3 +1,36 @@
+2012-05-20  Kentaro Hara  <[email protected]>
+
+        [V8] Pass Isolate to V8NPObject::npObjectGetProperty() and V8NPObject::npObjectSetProperty()
+        https://bugs.webkit.org/show_bug.cgi?id=86979
+
+        Reviewed by Adam Barth.
+
+        The objective is to pass Isolate around in V8 bindings.
+        This patch passes Isolate to V8NPObject::npObjectGetProperty()
+        and V8NPObject::npObjectSetProperty().
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8NPObject.cpp:
+        (WebCore::npObjectGetProperty):
+        (WebCore::npObjectNamedPropertyGetter):
+        (WebCore::npObjectIndexedPropertyGetter):
+        (WebCore::npObjectGetNamedProperty):
+        (WebCore::npObjectGetIndexedProperty):
+        (WebCore::npObjectQueryProperty):
+        (WebCore::npObjectSetProperty):
+        (WebCore::npObjectNamedPropertySetter):
+        (WebCore::npObjectIndexedPropertySetter):
+        (WebCore::npObjectSetNamedProperty):
+        (WebCore::npObjectSetIndexedProperty):
+        * bindings/v8/V8NPObject.h:
+        (WebCore):
+        * bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
+        (WebCore::npObjectNamedGetter):
+        (WebCore::npObjectNamedSetter):
+        (WebCore::npObjectIndexedGetter):
+        (WebCore::npObjectIndexedSetter):
+
 2012-05-20  Ryosuke Niwa  <[email protected]>
 
         Using createContextualFragment to insert a <script> does not cause the script to execute

Modified: trunk/Source/WebCore/bindings/v8/V8NPObject.cpp (117731 => 117732)


--- trunk/Source/WebCore/bindings/v8/V8NPObject.cpp	2012-05-21 06:11:02 UTC (rev 117731)
+++ trunk/Source/WebCore/bindings/v8/V8NPObject.cpp	2012-05-21 06:20:01 UTC (rev 117732)
@@ -183,19 +183,19 @@
 }
 
 
-static v8::Handle<v8::Value> npObjectGetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> key)
+static v8::Handle<v8::Value> npObjectGetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> key, v8::Isolate* isolate)
 {
     NPObject* npObject = v8ObjectToNPObject(self);
 
     // Verify that our wrapper wasn't using a NPObject which
     // has already been deleted.
     if (!npObject || !_NPN_IsAlive(npObject))
-        return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+        return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", isolate);
 
 
     if (npObject->_class->hasProperty && npObject->_class->getProperty && npObject->_class->hasProperty(npObject, identifier)) {
         if (!_NPN_IsAlive(npObject))
-            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", isolate);
 
         NPVariant result;
         VOID_TO_NPVARIANT(result);
@@ -211,11 +211,11 @@
     }
 
     if (!_NPN_IsAlive(npObject))
-        return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+        return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", isolate);
 
     if (key->IsString() && npObject->_class->hasMethod && npObject->_class->hasMethod(npObject, identifier)) {
         if (!_NPN_IsAlive(npObject))
-            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", isolate);
 
         PrivateIdentifier* id = static_cast<PrivateIdentifier*>(identifier);
         v8::Persistent<v8::FunctionTemplate> functionTemplate = staticTemplateMap().get(id);
@@ -240,46 +240,46 @@
 v8::Handle<v8::Value> npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = getStringIdentifier(name);
-    return npObjectGetProperty(info.Holder(), identifier, name);
+    return npObjectGetProperty(info.Holder(), identifier, name, info.GetIsolate());
 }
 
 v8::Handle<v8::Value> npObjectIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = _NPN_GetIntIdentifier(index);
-    return npObjectGetProperty(info.Holder(), identifier, v8::Number::New(index));
+    return npObjectGetProperty(info.Holder(), identifier, v8::Number::New(index), info.GetIsolate());
 }
 
-v8::Handle<v8::Value> npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name)
+v8::Handle<v8::Value> npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = getStringIdentifier(name);
-    return npObjectGetProperty(self, identifier, name);
+    return npObjectGetProperty(self, identifier, name, info.GetIsolate());
 }
 
-v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index)
+v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = _NPN_GetIntIdentifier(index);
-    return npObjectGetProperty(self, identifier, v8::Number::New(index));
+    return npObjectGetProperty(self, identifier, v8::Number::New(index), info.GetIsolate());
 }
 
 v8::Handle<v8::Integer> npObjectQueryProperty(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = getStringIdentifier(name);
-    return npObjectGetProperty(info.Holder(), identifier, name).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None);
+    return npObjectGetProperty(info.Holder(), identifier, name, info.GetIsolate()).IsEmpty() ? v8::Handle<v8::Integer>() : v8::Integer::New(v8::None);
 }
 
-static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value)
+static v8::Handle<v8::Value> npObjectSetProperty(v8::Local<v8::Object> self, NPIdentifier identifier, v8::Local<v8::Value> value, v8::Isolate* isolate)
 {
     NPObject* npObject = v8ObjectToNPObject(self);
 
     // Verify that our wrapper wasn't using a NPObject which has already been deleted.
     if (!npObject || !_NPN_IsAlive(npObject)) {
-        V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+        V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", isolate);
         return value;  // Intercepted, but an exception was thrown.
     }
 
     if (npObject->_class->hasProperty && npObject->_class->setProperty && npObject->_class->hasProperty(npObject, identifier)) {
         if (!_NPN_IsAlive(npObject))
-            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted");
+            return V8Proxy::throwError(V8Proxy::ReferenceError, "NPObject deleted", isolate);
 
         NPVariant npValue;
         VOID_TO_NPVARIANT(npValue);
@@ -296,26 +296,26 @@
 v8::Handle<v8::Value> npObjectNamedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = getStringIdentifier(name);
-    return npObjectSetProperty(info.Holder(), identifier, value);
+    return npObjectSetProperty(info.Holder(), identifier, value, info.GetIsolate());
 }
 
 
 v8::Handle<v8::Value> npObjectIndexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = _NPN_GetIntIdentifier(index);
-    return npObjectSetProperty(info.Holder(), identifier, value);
+    return npObjectSetProperty(info.Holder(), identifier, value, info.GetIsolate());
 }
 
-v8::Handle<v8::Value> npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value> value)
+v8::Handle<v8::Value> npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = getStringIdentifier(name);
-    return npObjectSetProperty(self, identifier, value);
+    return npObjectSetProperty(self, identifier, value, info.GetIsolate());
 }
 
-v8::Handle<v8::Value> npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value> value)
+v8::Handle<v8::Value> npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
 {
     NPIdentifier identifier = _NPN_GetIntIdentifier(index);
-    return npObjectSetProperty(self, identifier, value);
+    return npObjectSetProperty(self, identifier, value, info.GetIsolate());
 }
 
 v8::Handle<v8::Array> npObjectPropertyEnumerator(const v8::AccessorInfo& info, bool namedProperty)

Modified: trunk/Source/WebCore/bindings/v8/V8NPObject.h (117731 => 117732)


--- trunk/Source/WebCore/bindings/v8/V8NPObject.h	2012-05-21 06:11:02 UTC (rev 117731)
+++ trunk/Source/WebCore/bindings/v8/V8NPObject.h	2012-05-21 06:20:01 UTC (rev 117732)
@@ -45,14 +45,14 @@
 // Getters
 v8::Handle<v8::Value> npObjectNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo&);
 v8::Handle<v8::Value> npObjectIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo&);
-v8::Handle<v8::Value> npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name);
-v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index);
+v8::Handle<v8::Value> npObjectGetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, const v8::AccessorInfo&);
+v8::Handle<v8::Value> npObjectGetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, const v8::AccessorInfo&);
 
 // Setters
 v8::Handle<v8::Value> npObjectNamedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::AccessorInfo&);
 v8::Handle<v8::Value> npObjectIndexedPropertySetter(uint32_t index, const v8::AccessorInfo&);
-v8::Handle<v8::Value> npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value>);
-v8::Handle<v8::Value> npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value>);
+v8::Handle<v8::Value> npObjectSetNamedProperty(v8::Local<v8::Object> self, v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::AccessorInfo&);
+v8::Handle<v8::Value> npObjectSetIndexedProperty(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8::Value>, const v8::AccessorInfo&);
 
 v8::Handle<v8::Value> npObjectInvokeDefaultHandler(const v8::Arguments&);
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp (117731 => 117732)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp	2012-05-21 06:11:02 UTC (rev 117731)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp	2012-05-21 06:20:01 UTC (rev 117732)
@@ -56,7 +56,7 @@
     if (instance.IsEmpty())
         return notHandledByInterceptor();
 
-    return npObjectGetNamedProperty(instance, name);
+    return npObjectGetNamedProperty(instance, name, info);
 }
 
 template <class C>
@@ -71,7 +71,7 @@
     if (instance.IsEmpty())
         return notHandledByInterceptor();
 
-    return npObjectSetNamedProperty(instance, name, value);
+    return npObjectSetNamedProperty(instance, name, value, info);
 }
 
 v8::Handle<v8::Value> V8HTMLAppletElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
@@ -141,7 +141,7 @@
     if (instance.IsEmpty())
         return notHandledByInterceptor();
 
-    return npObjectGetIndexedProperty(instance, index);
+    return npObjectGetIndexedProperty(instance, index, info);
 }
 
 template <class C>
@@ -157,7 +157,7 @@
     if (instance.IsEmpty())
         return notHandledByInterceptor();
 
-    return npObjectSetIndexedProperty(instance, index, value);
+    return npObjectSetIndexedProperty(instance, index, value, info);
 }
 
 v8::Handle<v8::Value> V8HTMLAppletElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to