Title: [255271] trunk
Revision
255271
Author
[email protected]
Date
2020-01-28 13:02:32 -0800 (Tue, 28 Jan 2020)

Log Message

Reset the application bundle identifier between test runs
https://bugs.webkit.org/show_bug.cgi?id=206858
<rdar://problem/58844002>

Reviewed by Per Arne Vollan.

Clear the application bundle identifier set during testing when resetting the test system
to a known state in preparation for the next run.

Source/WebCore:

Tests: fast/sandbox/ios/sandbox-mach-lookup.html, fast/sandbox/ios/sandbox-mach-lookup-mail.html

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::clearApplicationBundleIdentifierTestingOverride): Added.

Source/WebKit:

Tests: fast/sandbox/ios/sandbox-mach-lookup.html, fast/sandbox/ios/sandbox-mach-lookup-mail.html

* UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* UIProcess/API/Cocoa/WKWebViewTesting.mm:
(+[WKWebView _clearApplicationBundleIdentifierTestingOverride]): Added.

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues): Clear any override for the application
bundle identifier before the next test invocation.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::setApplicationBundleIdentifier): Correct an over-release caused by assigning
an autorelease return value to an NSRetainPtr.
(WTR::TestController::clearApplicationBundleIdentifierTestingOverride): Added.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (255270 => 255271)


--- trunk/Source/WebCore/ChangeLog	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Source/WebCore/ChangeLog	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,3 +1,20 @@
+2020-01-28  Brent Fulgham  <[email protected]>
+
+        Reset the application bundle identifier between test runs
+        https://bugs.webkit.org/show_bug.cgi?id=206858
+        <rdar://problem/58844002>
+
+        Reviewed by Per Arne Vollan.
+
+        Clear the application bundle identifier set during testing when resetting the test system
+        to a known state in preparation for the next run.
+
+        Tests: fast/sandbox/ios/sandbox-mach-lookup.html, fast/sandbox/ios/sandbox-mach-lookup-mail.html
+
+        * platform/RuntimeApplicationChecks.h:
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::clearApplicationBundleIdentifierTestingOverride): Added.
+
 2020-01-28  Andres Gonzalez  <[email protected]>
 
         Regression: 30+ layout-test crash on Windows

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (255270 => 255271)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -48,6 +48,7 @@
 
 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
 WEBCORE_EXPORT String applicationBundleIdentifier();
+WEBCORE_EXPORT void clearApplicationBundleIdentifierTestingOverride();
 
 #if PLATFORM(MAC)
 

Modified: trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm (255270 => 255271)


--- trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -66,6 +66,15 @@
     applicationBundleIdentifierOverride() = bundleIdentifier;
 }
 
+void clearApplicationBundleIdentifierTestingOverride()
+{
+    ASSERT(RunLoop::isMain());
+    applicationBundleIdentifierOverride() = emptyString();
+#if !ASSERT_MSG_DISABLED
+    applicationBundleIdentifierOverrideWasQueried = false;
+#endif
+}
+
 static Optional<uint32_t>& applicationSDKVersionOverride()
 {
     static NeverDestroyed<Optional<uint32_t>> version;

Modified: trunk/Source/WebKit/ChangeLog (255270 => 255271)


--- trunk/Source/WebKit/ChangeLog	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Source/WebKit/ChangeLog	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,3 +1,20 @@
+2020-01-28  Brent Fulgham  <[email protected]>
+
+        Reset the application bundle identifier between test runs
+        https://bugs.webkit.org/show_bug.cgi?id=206858
+        <rdar://problem/58844002>
+
+        Reviewed by Per Arne Vollan.
+
+        Clear the application bundle identifier set during testing when resetting the test system
+        to a known state in preparation for the next run.
+
+        Tests: fast/sandbox/ios/sandbox-mach-lookup.html, fast/sandbox/ios/sandbox-mach-lookup-mail.html
+
+        * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
+        * UIProcess/API/Cocoa/WKWebViewTesting.mm:
+        (+[WKWebView _clearApplicationBundleIdentifierTestingOverride]): Added.
+
 2020-01-24  Sergio Villar Senin  <[email protected]>
 
         Remove WebVR from the tree

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h (255270 => 255271)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h	2020-01-28 21:02:32 UTC (rev 255271)
@@ -60,5 +60,6 @@
 - (void)_setAssertionStateForTesting:(int)state;
 
 + (void)_setApplicationBundleIdentifier:(NSString *)bundleIdentifier;
++ (void)_clearApplicationBundleIdentifierTestingOverride;
 
 @end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm (255270 => 255271)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -208,4 +208,9 @@
     WebCore::setApplicationBundleIdentifier(String(bundleIdentifier));
 }
 
++ (void)_clearApplicationBundleIdentifierTestingOverride
+{
+    WebCore::clearApplicationBundleIdentifierTestingOverride();
+}
+
 @end

Modified: trunk/Tools/ChangeLog (255270 => 255271)


--- trunk/Tools/ChangeLog	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Tools/ChangeLog	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,3 +1,22 @@
+2020-01-28  Brent Fulgham  <[email protected]>
+
+        Reset the application bundle identifier between test runs
+        https://bugs.webkit.org/show_bug.cgi?id=206858
+        <rdar://problem/58844002>
+
+        Reviewed by Per Arne Vollan.
+
+        Clear the application bundle identifier set during testing when resetting the test system
+        to a known state in preparation for the next run.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues): Clear any override for the application
+        bundle identifier before the next test invocation.
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::setApplicationBundleIdentifier): Correct an over-release caused by assigning
+        an autorelease return value to an NSRetainPtr.
+        (WTR::TestController::clearApplicationBundleIdentifierTestingOverride): Added.
+
 2020-01-28  Aakash Jain  <[email protected]>
 
         EWS django app should send cq+ patches to commit-queue

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (255270 => 255271)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1087,6 +1087,10 @@
 
     setHidden(false);
 
+#if PLATFORM(COCOA)
+    clearApplicationBundleIdentifierTestingOverride();
+#endif
+
     if (!platformResetStateToConsistentValues(options))
         return false;
 

Modified: trunk/Tools/WebKitTestRunner/TestController.h (255270 => 255271)


--- trunk/Tools/WebKitTestRunner/TestController.h	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2020-01-28 21:02:32 UTC (rev 255271)
@@ -364,6 +364,7 @@
     void cocoaPlatformInitialize();
     void cocoaResetStateToConsistentValues(const TestOptions&);
     void setApplicationBundleIdentifier(const String&);
+    void clearApplicationBundleIdentifierTestingOverride();
 #endif
     void platformConfigureViewForTest(const TestInvocation&);
     void platformWillRunTest(const TestInvocation&);

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (255270 => 255271)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2020-01-28 20:51:28 UTC (rev 255270)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2020-01-28 21:02:32 UTC (rev 255271)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -245,10 +245,15 @@
     if (bundleIdentifier.isEmpty())
         return;
     
-    auto applicationBundleIdentifier = adoptNS([NSString stringWithUTF8String:bundleIdentifier.utf8().data()]);
-    [TestRunnerWKWebView _setApplicationBundleIdentifier:applicationBundleIdentifier.get()];
+    [TestRunnerWKWebView _setApplicationBundleIdentifier:(NSString *)bundleIdentifier.createCFString().get()];
 }
 
+void TestController::clearApplicationBundleIdentifierTestingOverride()
+{
+    [TestRunnerWKWebView _clearApplicationBundleIdentifierTestingOverride];
+    m_hasSetApplicationBundleIdentifier = false;
+}
+
 void TestController::cocoaResetStateToConsistentValues(const TestOptions& options)
 {
     m_calendarSwizzler = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to