Title: [118726] trunk/Source/WebCore
Revision
118726
Author
[email protected]
Date
2012-05-28 23:42:08 -0700 (Mon, 28 May 2012)

Log Message

[V8] Implement V8Binding::v8Null(isolate) and use it in CodeGeneratorV8.pm
https://bugs.webkit.org/show_bug.cgi?id=87692

Reviewed by Adam Barth.

Since v8::Null(isolate) crashes if we pass a NULL isolate, we are planning
to pass Isolate to v8::Null() in the following steps:

[1] Implement V8Bindings::v8Null(isolate). v8Null(isolate) does the NULL check.
If isolate is NULL, v8Null(isolate) calls v8::Null(). Otherwise,
v8Null(isolate) calls v8::Null(isolate).

[2] In V8 bindings, we replace v8::Null() with v8::Null(isolate) for a non-optional
'isolate' parameter. (e.g. void foo(..., Isolate* isolate) { v8::Null(); } )

[3] In V8 bindings, we replace v8::Null() with v8Null(isolate) for an optional
'isolate' parameter. (e.g. void foo(..., Isolate* isolate = 0) { v8::Null(); } )

This bug fixes [1] by implementing V8Binding::v8Null(isolate). Also this patch uses
V8Binding::v8Null(isolate) in bindings/v8/*.{h,cpp}.

No tests. No behavior change.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):
(NativeToJSValue):
* bindings/scripts/test/V8/V8Float64Array.h:
* bindings/scripts/test/V8/V8TestActiveDOMObject.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestCustomNamedGetter.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestEventConstructor.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestEventTarget.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestException.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestInterface.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestMediaQueryListListener.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestNamedConstructor.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestNode.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestObj.h:
(WebCore::toV8):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
(WebCore::TestSerializedScriptValueInterfaceV8Internal::valueAttrGetter):
(WebCore::TestSerializedScriptValueInterfaceV8Internal::readonlyValueAttrGetter):
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:
(WebCore::toV8):
* bindings/v8/V8Binding.h:
(WebCore::v8Null):
(WebCore):
(WebCore::v8DateOrNull):
* bindings/v8/V8DOMWrapper.cpp:
* bindings/v8/V8DOMWrapper.h:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118725 => 118726)


--- trunk/Source/WebCore/ChangeLog	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/ChangeLog	2012-05-29 06:42:08 UTC (rev 118726)
@@ -1,3 +1,65 @@
+2012-05-28  Kentaro Hara  <[email protected]>
+
+        [V8] Implement V8Binding::v8Null(isolate) and use it in CodeGeneratorV8.pm
+        https://bugs.webkit.org/show_bug.cgi?id=87692
+
+        Reviewed by Adam Barth.
+
+        Since v8::Null(isolate) crashes if we pass a NULL isolate, we are planning
+        to pass Isolate to v8::Null() in the following steps:
+
+        [1] Implement V8Bindings::v8Null(isolate). v8Null(isolate) does the NULL check.
+        If isolate is NULL, v8Null(isolate) calls v8::Null(). Otherwise,
+        v8Null(isolate) calls v8::Null(isolate).
+
+        [2] In V8 bindings, we replace v8::Null() with v8::Null(isolate) for a non-optional
+        'isolate' parameter. (e.g. void foo(..., Isolate* isolate) { v8::Null(); } )
+
+        [3] In V8 bindings, we replace v8::Null() with v8Null(isolate) for an optional
+        'isolate' parameter. (e.g. void foo(..., Isolate* isolate = 0) { v8::Null(); } )
+
+        This bug fixes [1] by implementing V8Binding::v8Null(isolate). Also this patch uses
+        V8Binding::v8Null(isolate) in bindings/v8/*.{h,cpp}.
+
+        No tests. No behavior change.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateHeader):
+        (NativeToJSValue):
+        * bindings/scripts/test/V8/V8Float64Array.h:
+        * bindings/scripts/test/V8/V8TestActiveDOMObject.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestCustomNamedGetter.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestEventConstructor.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestEventTarget.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestException.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestInterface.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestMediaQueryListListener.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestNamedConstructor.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestNode.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestObj.h:
+        (WebCore::toV8):
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
+        (WebCore::TestSerializedScriptValueInterfaceV8Internal::valueAttrGetter):
+        (WebCore::TestSerializedScriptValueInterfaceV8Internal::readonlyValueAttrGetter):
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h:
+        (WebCore::toV8):
+        * bindings/v8/V8Binding.h:
+        (WebCore::v8Null):
+        (WebCore):
+        (WebCore::v8DateOrNull):
+        * bindings/v8/V8DOMWrapper.cpp:
+        * bindings/v8/V8DOMWrapper.h:
+        (WebCore):
+
 2012-05-28  Kent Tamura  <[email protected]>
 
         Fix a crash in HTMLFormControlElement::disabled().

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-05-29 06:42:08 UTC (rev 118726)
@@ -249,6 +249,7 @@
 
     $headerIncludes{"wtf/text/StringHash.h"} = 1;
     $headerIncludes{"WrapperTypeInfo.h"} = 1;
+    $headerIncludes{"V8Binding.h"} = 1;
     $headerIncludes{"V8DOMWrapper.h"} = 1;
     $headerIncludes{"wtf/HashMap.h"} = 1;
     $headerIncludes{"v8.h"} = 1;
@@ -455,7 +456,7 @@
 inline v8::Handle<v8::Value> toV8(${nativeType}* impl, v8::Isolate* isolate = 0${forceNewObjectParameter})
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return ${className}::wrap(impl, isolate${forceNewObjectCall});
 }
 END
@@ -472,7 +473,7 @@
 inline v8::Handle<v8::Value> toV8(Node* impl, v8::Isolate* isolate = 0, bool forceNewObject = false)
 {
     if (UNLIKELY(!impl))
-        return v8::Null();
+        return v8Null(isolate);
     if (UNLIKELY(forceNewObject))
         return toV8Slow(impl, isolate, forceNewObject);
     v8::Handle<v8::Value> wrapper = V8DOMWrapper::getCachedWrapper(impl);
@@ -3798,7 +3799,7 @@
     my $signature = shift;
     my $value = shift;
     my $getIsolate = shift;
-    $getIsolate = $getIsolate ? ", $getIsolate" : "";
+    my $getIsolateArg = $getIsolate ? ", $getIsolate" : "";
     my $type = GetTypeFromSignature($signature);
 
     return "v8Boolean($value)" if $type eq "boolean";
@@ -3818,7 +3819,7 @@
     return "v8::Integer::New($value)" if $nativeType eq "int";
     return "v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned";
 
-    return "v8DateOrNull($value)" if $type eq "Date";
+    return "v8DateOrNull($value$getIsolateArg)" if $type eq "Date";
     # long long and unsigned long long are not representable in ECMAScript.
     return "v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp";
     return "v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type);
@@ -3830,13 +3831,13 @@
     if ($codeGenerator->IsStringType($type)) {
         my $conv = $signature->extendedAttributes->{"TreatReturnedNullStringAs"};
         if (defined $conv) {
-            return "v8StringOrNull($value$getIsolate)" if $conv eq "Null";
-            return "v8StringOrUndefined($value$getIsolate)" if $conv eq "Undefined";
-            return "v8StringOrFalse($value$getIsolate)" if $conv eq "False";
+            return "v8StringOrNull($value$getIsolateArg)" if $conv eq "Null";
+            return "v8StringOrUndefined($value$getIsolateArg)" if $conv eq "Undefined";
+            return "v8StringOrFalse($value$getIsolateArg)" if $conv eq "False";
 
             die "Unknown value for TreatReturnedNullStringAs extended attribute";
         }
-        return "v8String($value$getIsolate)";
+        return "v8String($value$getIsolateArg)";
     }
 
     my $arrayType = $codeGenerator->GetArrayType($type);
@@ -3845,35 +3846,35 @@
             AddToImplIncludes("V8$arrayType.h");
             AddToImplIncludes("$arrayType.h");
         }
-        return "v8Array($value$getIsolate)";
+        return "v8Array($value$getIsolateArg)";
     }
 
     AddIncludesForType($type);
 
     # special case for non-DOM node interfaces
     if (IsDOMNodeType($type)) {
-        return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnNewObject"} ? "$getIsolate, true)" : "$getIsolate)");
+        return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnNewObject"} ? "$getIsolateArg, true)" : "$getIsolateArg)");
     }
 
     if ($type eq "EventTarget") {
-        return "V8DOMWrapper::convertEventTargetToV8Object($value$getIsolate)";
+        return "V8DOMWrapper::convertEventTargetToV8Object($value$getIsolateArg)";
     }
 
     if ($type eq "EventListener") {
         AddToImplIncludes("V8AbstractEventListener.h");
-        return "${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null())";
+        return "${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(" . ($getIsolate ? "v8::Null($getIsolate)" : "v8::Null()") . ")";
     }
 
     if ($type eq "SerializedScriptValue") {
         AddToImplIncludes("$type.h");
-        return "$value ? $value->deserialize() : v8::Handle<v8::Value>(v8::Null())";
+        return "$value ? $value->deserialize() : v8::Handle<v8::Value>(" . ($getIsolate ? "v8::Null($getIsolate)" : "v8::Null()") . ")";
     }
 
     AddToImplIncludes("wtf/RefCounted.h");
     AddToImplIncludes("wtf/RefPtr.h");
     AddToImplIncludes("wtf/GetPtr.h");
 
-    return "toV8($value$getIsolate)";
+    return "toV8($value$getIsolateArg)";
 }
 
 sub ReturnNativeToJSValue

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8Float64Array_h
 
 #include "V8ArrayBufferView.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestActiveDOMObject_h
 
 #include "TestActiveDOMObject.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -61,7 +62,7 @@
 inline v8::Handle<v8::Value> toV8(TestActiveDOMObject* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestActiveDOMObject::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestActiveDOMObject > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestCustomNamedGetter_h
 
 #include "TestCustomNamedGetter.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -60,7 +61,7 @@
 inline v8::Handle<v8::Value> toV8(TestCustomNamedGetter* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestCustomNamedGetter::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomNamedGetter > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestEventConstructor_h
 
 #include "TestEventConstructor.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -61,7 +62,7 @@
 inline v8::Handle<v8::Value> toV8(TestEventConstructor* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestEventConstructor::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventConstructor > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestEventTarget_h
 
 #include "TestEventTarget.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -62,7 +63,7 @@
 inline v8::Handle<v8::Value> toV8(TestEventTarget* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestEventTarget::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestEventTarget > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestException_h
 
 #include "TestException.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -59,7 +60,7 @@
 inline v8::Handle<v8::Value> toV8(TestException* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestException::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestException > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -24,6 +24,7 @@
 #define V8TestInterface_h
 
 #include "TestInterface.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -64,7 +65,7 @@
 inline v8::Handle<v8::Value> toV8(TestInterface* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestInterface::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestInterface > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestMediaQueryListListener_h
 
 #include "TestMediaQueryListListener.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -59,7 +60,7 @@
 inline v8::Handle<v8::Value> toV8(TestMediaQueryListListener* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestMediaQueryListListener::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestMediaQueryListListener > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestNamedConstructor_h
 
 #include "TestNamedConstructor.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -66,7 +67,7 @@
 inline v8::Handle<v8::Value> toV8(TestNamedConstructor* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestNamedConstructor::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestNamedConstructor > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestNode_h
 
 #include "TestNode.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -60,7 +61,7 @@
 inline v8::Handle<v8::Value> toV8(TestNode* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestNode::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestNode > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -22,6 +22,7 @@
 #define V8TestObj_h
 
 #include "TestObj.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -66,7 +67,7 @@
 inline v8::Handle<v8::Value> toV8(TestObj* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestObj::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestObj > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp	2012-05-29 06:42:08 UTC (rev 118726)
@@ -50,7 +50,7 @@
 {
     INC_STATS("DOM.TestSerializedScriptValueInterface.value._get");
     TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder());
-    return imp->value() ? imp->value()->deserialize() : v8::Handle<v8::Value>(v8::Null());
+    return imp->value() ? imp->value()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()));
 }
 
 static void valueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
@@ -66,7 +66,7 @@
 {
     INC_STATS("DOM.TestSerializedScriptValueInterface.readonlyValue._get");
     TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder());
-    return imp->readonlyValue() ? imp->readonlyValue()->deserialize() : v8::Handle<v8::Value>(v8::Null());
+    return imp->readonlyValue() ? imp->readonlyValue()->deserialize() : v8::Handle<v8::Value>(v8::Null(info.GetIsolate()));
 }
 
 static v8::Handle<v8::Value> cachedValueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -24,6 +24,7 @@
 #define V8TestSerializedScriptValueInterface_h
 
 #include "TestSerializedScriptValueInterface.h"
+#include "V8Binding.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
 #include <v8.h>
@@ -62,7 +63,7 @@
 inline v8::Handle<v8::Value> toV8(TestSerializedScriptValueInterface* impl, v8::Isolate* isolate = 0)
 {
     if (!impl)
-        return v8::Null();
+        return v8Null(isolate);
     return V8TestSerializedScriptValueInterface::wrap(impl, isolate);
 }
 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestSerializedScriptValueInterface > impl, v8::Isolate* isolate = 0)

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -247,6 +247,15 @@
     template <typename StringType>
     StringType v8StringToWebCoreString(v8::Handle<v8::String> v8String, ExternalMode external);
 
+    // Since v8::Null(isolate) crashes if we pass a null isolate,
+    // we need to instead use v8Null(isolate).
+    //
+    // FIXME: Remove all null isolates from V8 bindings, and remove v8Null(isolate).
+    inline v8::Handle<v8::Value> v8Null(v8::Isolate* isolate)
+    {
+        return isolate ? v8::Null(isolate) : v8::Null();
+    }
+
     // Convert v8 types to a WTF::String. If the V8 string is not already
     // an external string then it is transformed into an external string at this
     // point to avoid repeated conversions.
@@ -448,9 +457,9 @@
         return (object->IsDate() || object->IsNumber()) ? object->NumberValue() : std::numeric_limits<double>::quiet_NaN();
     }
 
-    inline v8::Handle<v8::Value> v8DateOrNull(double value)
+    inline v8::Handle<v8::Value> v8DateOrNull(double value, v8::Isolate* isolate = 0)
     {
-        return isfinite(value) ? v8::Date::New(value) : v8::Handle<v8::Value>(v8::Null());
+        return isfinite(value) ? v8::Date::New(value) : v8Null(isolate);
     }
 
     v8::Persistent<v8::FunctionTemplate> createRawTemplate();

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp (118725 => 118726)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2012-05-29 06:42:08 UTC (rev 118726)
@@ -54,10 +54,12 @@
 #include "V8Proxy.h"
 #include "V8StyleSheet.h"
 #include "V8WorkerContextEventListener.h"
+#include "V8XPathNSResolver.h"
 #include "WebGLContextAttributes.h"
 #include "WebGLUniformLocation.h"
 #include "WorkerContextExecutionProxy.h"
 #include "WrapperTypeInfo.h"
+#include "XPathNSResolver.h"
 #include <algorithm>
 #include <utility>
 #include <v8-debug.h>

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h (118725 => 118726)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h	2012-05-29 05:37:57 UTC (rev 118725)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h	2012-05-29 06:42:08 UTC (rev 118726)
@@ -39,12 +39,9 @@
 #include "PlatformString.h"
 #include "V8CustomXPathNSResolver.h"
 #include "V8DOMMap.h"
-#include "V8Event.h"
 #include "V8IsolatedContext.h"
 #include "V8Utilities.h"
-#include "V8XPathNSResolver.h"
 #include "WrapperTypeInfo.h"
-#include "XPathNSResolver.h"
 #include <v8.h>
 #include <wtf/MainThread.h>
 #include <wtf/PassRefPtr.h>
@@ -58,6 +55,7 @@
     class V8BindingPerContextData;
     class V8Proxy;
     class WorkerContext;
+    class XPathResolver;
 
     enum ListenerLookupType {
         ListenerFindOnly,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to