Title: [149521] trunk/Source/WebCore
Revision
149521
Author
[email protected]
Date
2013-05-03 02:34:36 -0700 (Fri, 03 May 2013)

Log Message

Crash when calling QWebFrame::evaluateJavaScript
https://bugs.webkit.org/show_bug.cgi?id=113434

Reviewed by Simon Hausmann.

We must take the JS API lock before accessing internal JS methods.

* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::unwrapBoxedPrimitive):
(JSC::Bindings::getGregorianDateTimeUTC):
(JSC::Bindings::convertQVariantToValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149520 => 149521)


--- trunk/Source/WebCore/ChangeLog	2013-05-03 07:10:20 UTC (rev 149520)
+++ trunk/Source/WebCore/ChangeLog	2013-05-03 09:34:36 UTC (rev 149521)
@@ -1,3 +1,17 @@
+2013-05-03  Allan Sandfeld Jensen  <[email protected]>
+
+        Crash when calling QWebFrame::evaluateJavaScript
+        https://bugs.webkit.org/show_bug.cgi?id=113434
+
+        Reviewed by Simon Hausmann.
+
+        We must take the JS API lock before accessing internal JS methods.
+
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::unwrapBoxedPrimitive):
+        (JSC::Bindings::getGregorianDateTimeUTC):
+        (JSC::Bindings::convertQVariantToValue):
+
 2013-05-02  Xan Lopez  <[email protected]>
 
         [GTK] Fine tune dependencies for glslang generated files

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (149520 => 149521)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2013-05-03 07:10:20 UTC (rev 149520)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2013-05-03 09:34:36 UTC (rev 149521)
@@ -21,6 +21,7 @@
 #include "qt_runtime.h"
 
 #include "APICast.h"
+#include "APIShims.h"
 #include "BooleanObject.h"
 #include "DateInstance.h"
 #include "DatePrototype.h"
@@ -199,8 +200,9 @@
 
 static JSValueRef unwrapBoxedPrimitive(JSContextRef context, JSValueRef value, JSObjectRef obj)
 {
+    ExecState* exec = toJS(context);
+    APIEntryShim entryShim(exec);
     JSObject* object = toJS(obj);
-    ExecState* exec = toJS(context);
     if (object->inherits(&NumberObject::s_info))
         return toRef(exec, jsNumber(object->toNumber(exec)));
     if (object->inherits(&StringObject::s_info))
@@ -281,6 +283,7 @@
 static void getGregorianDateTimeUTC(JSContextRef context, JSRealType type, JSValueRef value, JSObjectRef object, JSValueRef* exception, GregorianDateTime* gdt)
 {
     ExecState* exec = toJS(context);
+    APIEntryShim entryShim(exec);
     if (type == Date) {
         JSObject* jsObject = toJS(object);
         DateInstance* date = asDateInstance(jsObject);
@@ -729,6 +732,7 @@
         WTF::RefPtr<WTF::Uint8ClampedArray> wtfByteArray = WTF::Uint8ClampedArray::createUninitialized(qtByteArray.length());
         memcpy(wtfByteArray->data(), qtByteArray.constData(), qtByteArray.length());
         ExecState* exec = toJS(context);
+        APIEntryShim entryShim(exec);
         return toRef(exec, toJS(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), wtfByteArray.get()));
     }
 
@@ -737,6 +741,7 @@
         if (!obj)
             return JSValueMakeNull(context);
         ExecState* exec = toJS(context);
+        APIEntryShim entryShim(exec);
         return toRef(exec, QtInstance::getQtInstance(obj, root, QtInstance::QtOwnership)->createRuntimeObject(exec));
     }
 
@@ -751,6 +756,7 @@
         if (!document)
             return JSValueMakeUndefined(context);
         ExecState* exec = toJS(context);
+        APIEntryShim entryShim(exec);
         return toRef(exec, customRuntimeConversions()->value(type).toJSValueFunc(exec, toJSDOMGlobalObject(document, exec), variant));
     }
 
@@ -800,6 +806,7 @@
         QObjectList ol = variant.value<QObjectList>();
         JSObjectRef array = JSObjectMakeArray(context, 0, 0, exception);
         ExecState* exec = toJS(context);
+        APIEntryShim entryShim(exec);
         for (int i = 0; i < ol.count(); ++i) {
             JSValueRef jsObject = toRef(exec, QtInstance::getQtInstance(ol.at(i), root, QtInstance::QtOwnership)->createRuntimeObject(exec));
             JSObjectSetPropertyAtIndex(context, array, i, jsObject, /*ignored exception*/0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to