Title: [264866] trunk
Revision
264866
Author
[email protected]
Date
2020-07-24 15:56:01 -0700 (Fri, 24 Jul 2020)

Log Message

Fix exception check handling below postMessage().
https://bugs.webkit.org/show_bug.cgi?id=214761
<rdar://problem/65932136>

Reviewed by Yusuke Suzuki and Keith Miller.

Source/WebCore:

Test: js/dom/missing-exception-check-below-postMessage.html

* bindings/js/JSDOMConvertSequences.h:
(WebCore::Detail::SequenceConverter::convertArray):
(WebCore::Detail::SequenceConverter::convert):

LayoutTests:

* js/dom/missing-exception-check-below-postMessage-expected.txt: Added.
* js/dom/missing-exception-check-below-postMessage.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264865 => 264866)


--- trunk/LayoutTests/ChangeLog	2020-07-24 22:53:26 UTC (rev 264865)
+++ trunk/LayoutTests/ChangeLog	2020-07-24 22:56:01 UTC (rev 264866)
@@ -1,3 +1,14 @@
+2020-07-24  Mark Lam  <[email protected]>
+
+        Fix exception check handling below postMessage().
+        https://bugs.webkit.org/show_bug.cgi?id=214761
+        <rdar://problem/65932136>
+
+        Reviewed by Yusuke Suzuki and Keith Miller.
+
+        * js/dom/missing-exception-check-below-postMessage-expected.txt: Added.
+        * js/dom/missing-exception-check-below-postMessage.html: Added.
+
 2020-07-24  Kenneth Russell  <[email protected]>
 
         REGRESSION (r264845): webgl/2.0.0/conformance2/textures/misc/tex-unpack-params.html is failing

Added: trunk/LayoutTests/js/dom/missing-exception-check-below-postMessage-expected.txt (0 => 264866)


--- trunk/LayoutTests/js/dom/missing-exception-check-below-postMessage-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/dom/missing-exception-check-below-postMessage-expected.txt	2020-07-24 22:56:01 UTC (rev 264866)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: TypeError: Type error
+FAIL successfullyParsed should be true (of type boolean). Was undefined (of type undefined).
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/dom/missing-exception-check-below-postMessage.html (0 => 264866)


--- trunk/LayoutTests/js/dom/missing-exception-check-below-postMessage.html	                        (rev 0)
+++ trunk/LayoutTests/js/dom/missing-exception-check-below-postMessage.html	2020-07-24 22:56:01 UTC (rev 264866)
@@ -0,0 +1,12 @@
+<!DOCTYPE html><!-- webkit-test-runner [ jscOptions=--validateExceptionChecks=true ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+    postMessage(0, 0, {});
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (264865 => 264866)


--- trunk/Source/WebCore/ChangeLog	2020-07-24 22:53:26 UTC (rev 264865)
+++ trunk/Source/WebCore/ChangeLog	2020-07-24 22:56:01 UTC (rev 264866)
@@ -1,3 +1,17 @@
+2020-07-24  Mark Lam  <[email protected]>
+
+        Fix exception check handling below postMessage().
+        https://bugs.webkit.org/show_bug.cgi?id=214761
+        <rdar://problem/65932136>
+
+        Reviewed by Yusuke Suzuki and Keith Miller.
+
+        Test: js/dom/missing-exception-check-below-postMessage.html
+
+        * bindings/js/JSDOMConvertSequences.h:
+        (WebCore::Detail::SequenceConverter::convertArray):
+        (WebCore::Detail::SequenceConverter::convert):
+
 2020-07-24  Eric Carlson  <[email protected]>
 
         [Cocoa] Tell AVAssetResourceLoadingContentInformationRequest that asset size is available immediately

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertSequences.h (264865 => 264866)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertSequences.h	2020-07-24 22:53:26 UTC (rev 264865)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertSequences.h	2020-07-24 22:56:01 UTC (rev 264866)
@@ -195,8 +195,10 @@
     using GenericConverter = GenericSequenceConverter<IDLType>;
     using ReturnType = typename GenericConverter::ReturnType;
 
-    static ReturnType convertArray(JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope, JSC::JSArray* array)
+    static ReturnType convertArray(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSArray* array)
     {
+        auto& vm = lexicalGlobalObject.vm();
+        auto scope = DECLARE_THROW_SCOPE(vm);
         unsigned length = array->length();
 
         ReturnType result;
@@ -249,23 +251,20 @@
 
         JSC::JSObject* object = JSC::asObject(value);
         if (Converter<IDLType>::conversionHasSideEffects)
-            return GenericConverter::convert(lexicalGlobalObject, object);
+            RELEASE_AND_RETURN(scope, (GenericConverter::convert(lexicalGlobalObject, object)));
 
         if (!JSC::isJSArray(object))
-            return GenericConverter::convert(lexicalGlobalObject, object);
+            RELEASE_AND_RETURN(scope, (GenericConverter::convert(lexicalGlobalObject, object)));
 
         JSC::JSArray* array = JSC::asArray(object);
         if (!array->isIteratorProtocolFastAndNonObservable())
-            return GenericConverter::convert(lexicalGlobalObject, object);
+            RELEASE_AND_RETURN(scope, (GenericConverter::convert(lexicalGlobalObject, object)));
         
-        return convertArray(lexicalGlobalObject, scope, array);
+        RELEASE_AND_RETURN(scope, (convertArray(lexicalGlobalObject, array)));
     }
 
     static ReturnType convert(JSC::JSGlobalObject& lexicalGlobalObject, JSC::JSObject* object, JSC::JSValue method)
     {
-        auto& vm = JSC::getVM(&lexicalGlobalObject);
-        auto scope = DECLARE_THROW_SCOPE(vm);
-
         if (Converter<IDLType>::conversionHasSideEffects)
             return GenericConverter::convert(lexicalGlobalObject, object, method);
 
@@ -276,7 +275,7 @@
         if (!array->isIteratorProtocolFastAndNonObservable())
             return GenericConverter::convert(lexicalGlobalObject, object, method);
 
-        return convertArray(lexicalGlobalObject, scope, array);
+        return convertArray(lexicalGlobalObject, array);
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to