Title: [260679] trunk
Revision
260679
Author
[email protected]
Date
2020-04-24 16:32:04 -0700 (Fri, 24 Apr 2020)

Log Message

REGRESSION(260485) Payment requests don't do anything
https://bugs.webkit.org/show_bug.cgi?id=210997
Source/WTF:

<rdar://problem/62275343>

Patch by Alex Christensen <[email protected]> on 2020-04-24
Reviewed by Darin Adler.

We were giving the PKPaymentRequest an NSArray<NSString *> instead of NSArray<NSURL *>.
This was a problem with all uses of createNSArray with Vector<URL>.
Now it's fixed with a test.

* wtf/URL.h:
* wtf/cocoa/URLCocoa.mm:
(WTF::makeNSArrayElement):
(WTF::makeVectorElement):

Tools:

Patch by Alex Christensen <[email protected]> on 2020-04-24
Reviewed by Darin Adler.

* TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (260678 => 260679)


--- trunk/Source/WTF/ChangeLog	2020-04-24 23:18:05 UTC (rev 260678)
+++ trunk/Source/WTF/ChangeLog	2020-04-24 23:32:04 UTC (rev 260679)
@@ -1,3 +1,20 @@
+2020-04-24  Alex Christensen  <[email protected]>
+
+        REGRESSION(260485) Payment requests don't do anything
+        https://bugs.webkit.org/show_bug.cgi?id=210997
+        <rdar://problem/62275343>
+
+        Reviewed by Darin Adler.
+
+        We were giving the PKPaymentRequest an NSArray<NSString *> instead of NSArray<NSURL *>.
+        This was a problem with all uses of createNSArray with Vector<URL>.
+        Now it's fixed with a test.
+
+        * wtf/URL.h:
+        * wtf/cocoa/URLCocoa.mm:
+        (WTF::makeNSArrayElement):
+        (WTF::makeVectorElement):
+
 2020-04-24  Megan Gardner  <[email protected]>
 
         Make LEGACY_PDF_SUPPORT feature flag.

Modified: trunk/Source/WTF/wtf/URL.h (260678 => 260679)


--- trunk/Source/WTF/wtf/URL.h	2020-04-24 23:18:05 UTC (rev 260678)
+++ trunk/Source/WTF/wtf/URL.h	2020-04-24 23:32:04 UTC (rev 260679)
@@ -287,6 +287,13 @@
 // FIXME: This is a wrong concept to expose, different parts of a URL need different escaping per the URL Standard.
 WTF_EXPORT_PRIVATE String encodeWithURLEscapeSequences(const String&);
 
+#ifdef __OBJC__
+
+WTF_EXPORT_PRIVATE RetainPtr<id> makeNSArrayElement(const URL&);
+WTF_EXPORT_PRIVATE Optional<URL> makeVectorElement(const URL*, id);
+
+#endif
+
 // Inlines.
 
 inline bool operator==(const URL& a, const URL& b)

Modified: trunk/Source/WTF/wtf/cocoa/URLCocoa.mm (260678 => 260679)


--- trunk/Source/WTF/wtf/cocoa/URLCocoa.mm	2020-04-24 23:18:05 UTC (rev 260678)
+++ trunk/Source/WTF/wtf/cocoa/URLCocoa.mm	2020-04-24 23:32:04 UTC (rev 260679)
@@ -91,4 +91,16 @@
     return [host.createNSStringWithoutCopying().get() _web_looksLikeIPAddress];
 }
 
+RetainPtr<id> makeNSArrayElement(const URL& vectorElement)
+{
+    return adoptNS((__bridge_transfer id)vectorElement.createCFURL().leakRef());
 }
+
+Optional<URL> makeVectorElement(const URL*, id arrayElement)
+{
+    if (![arrayElement isKindOfClass:NSURL.class])
+        return WTF::nullopt;
+    return { { arrayElement } };
+}
+
+}

Modified: trunk/Tools/ChangeLog (260678 => 260679)


--- trunk/Tools/ChangeLog	2020-04-24 23:18:05 UTC (rev 260678)
+++ trunk/Tools/ChangeLog	2020-04-24 23:32:04 UTC (rev 260679)
@@ -1,3 +1,13 @@
+2020-04-24  Alex Christensen  <[email protected]>
+
+        REGRESSION(260485) Payment requests don't do anything
+        https://bugs.webkit.org/show_bug.cgi?id=210997
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
+        (TestWebKitAPI::TEST):
+
 2020-04-24  Wenson Hsieh  <[email protected]>
 
         Make some more adjustments to TextManipulationController's paragraph boundary heuristic

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm (260678 => 260679)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm	2020-04-24 23:18:05 UTC (rev 260678)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm	2020-04-24 23:32:04 UTC (rev 260679)
@@ -24,9 +24,11 @@
  */
 
 #import "config.h"
+#import <wtf/URL.h>
 
 #import <wtf/Vector.h>
 #import <wtf/cocoa/NSURLExtras.h>
+#import <wtf/cocoa/VectorCocoa.h>
 #import <wtf/text/WTFString.h>
 
 namespace TestWebKitAPI {
@@ -212,5 +214,12 @@
     EXPECT_TRUE(url2 == nil);
 }
 
+TEST(WTF_URLExtras, CreateNSArray)
+{
+    Vector<URL> urls { URL(URL(), "https://webkit.org/") };
+    auto array = createNSArray(urls);
+    EXPECT_TRUE([array.get()[0] isKindOfClass:NSURL.class]);
+}
+
 } // namespace TestWebKitAPI
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to