Title: [244812] trunk
Revision
244812
Author
[email protected]
Date
2019-04-30 16:56:05 -0700 (Tue, 30 Apr 2019)

Log Message

Unreviewed, rolling out r244802.

Caused an API test failure

Reverted changeset:

"Regression(PSON) URL scheme handlers can no longer respond
asynchronously"
https://bugs.webkit.org/show_bug.cgi?id=197426
https://trac.webkit.org/changeset/244802

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244811 => 244812)


--- trunk/Source/WebKit/ChangeLog	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Source/WebKit/ChangeLog	2019-04-30 23:56:05 UTC (rev 244812)
@@ -1,5 +1,18 @@
 2019-04-30  Chris Dumez  <[email protected]>
 
+        Unreviewed, rolling out r244802.
+
+        Caused an API test failure
+
+        Reverted changeset:
+
+        "Regression(PSON) URL scheme handlers can no longer respond
+        asynchronously"
+        https://bugs.webkit.org/show_bug.cgi?id=197426
+        https://trac.webkit.org/changeset/244802
+
+2019-04-30  Chris Dumez  <[email protected]>
+
         Regression(PSON) URL scheme handlers can no longer respond asynchronously
         https://bugs.webkit.org/show_bug.cgi?id=197426
         <rdar://problem/50256169>

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (244811 => 244812)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-04-30 23:56:05 UTC (rev 244812)
@@ -6741,7 +6741,7 @@
             automationSession->terminate();
     }
 
-    stopAllURLSchemeTasks(m_process.ptr());
+    stopAllURLSchemeTasks();
 }
 
 void WebPageProxy::provisionalProcessDidTerminate()
@@ -6801,7 +6801,7 @@
     m_recentCrashCount = 0;
 }
 
-void WebPageProxy::stopAllURLSchemeTasks(WebProcessProxy* process)
+void WebPageProxy::stopAllURLSchemeTasks()
 {
     HashSet<WebURLSchemeHandler*> handlers;
     for (auto& handler : m_urlSchemeHandlersByScheme.values())
@@ -6808,7 +6808,7 @@
         handlers.add(handler.ptr());
 
     for (auto* handler : handlers)
-        handler->stopAllTasksForPage(*this, process);
+        handler->stopAllTasksForPage(*this);
 }
 
 #if PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (244811 => 244812)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-04-30 23:56:05 UTC (rev 244812)
@@ -2001,7 +2001,7 @@
 
     void viewIsBecomingVisible();
 
-    void stopAllURLSchemeTasks(WebProcessProxy* = nullptr);
+    void stopAllURLSchemeTasks();
 
     void clearInspectorTargets();
     void createInspectorTargets();

Modified: trunk/Source/WebKit/UIProcess/WebURLSchemeHandler.cpp (244811 => 244812)


--- trunk/Source/WebKit/UIProcess/WebURLSchemeHandler.cpp	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Source/WebKit/UIProcess/WebURLSchemeHandler.cpp	2019-04-30 23:56:05 UTC (rev 244812)
@@ -60,31 +60,17 @@
     platformStartTask(page, result.iterator->value);
 }
 
-WebProcessProxy* WebURLSchemeHandler::processForTaskIdentifier(uint64_t taskIdentifier) const
+void WebURLSchemeHandler::stopAllTasksForPage(WebPageProxy& page)
 {
-    auto iterator = m_tasks.find(taskIdentifier);
-    if (iterator == m_tasks.end())
-        return nullptr;
-    return iterator->value->process();
-}
-
-void WebURLSchemeHandler::stopAllTasksForPage(WebPageProxy& page, WebProcessProxy* process)
-{
     auto iterator = m_tasksByPageIdentifier.find(page.pageID());
     if (iterator == m_tasksByPageIdentifier.end())
         return;
 
     auto& tasksByPage = iterator->value;
-    Vector<uint64_t> taskIdentifiersToStop;
-    taskIdentifiersToStop.reserveInitialCapacity(tasksByPage.size());
-    for (auto taskIdentifier : tasksByPage) {
-        if (!process || processForTaskIdentifier(taskIdentifier) == process)
-            taskIdentifiersToStop.uncheckedAppend(taskIdentifier);
-    }
+    while (!tasksByPage.isEmpty())
+        stopTask(page, *tasksByPage.begin());
 
-    for (auto& taskIdentifier : taskIdentifiersToStop)
-        stopTask(page, taskIdentifier);
-
+    ASSERT(m_tasksByPageIdentifier.find(page.pageID()) == m_tasksByPageIdentifier.end());
 }
 
 void WebURLSchemeHandler::stopTask(WebPageProxy& page, uint64_t taskIdentifier)

Modified: trunk/Source/WebKit/UIProcess/WebURLSchemeHandler.h (244811 => 244812)


--- trunk/Source/WebKit/UIProcess/WebURLSchemeHandler.h	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Source/WebKit/UIProcess/WebURLSchemeHandler.h	2019-04-30 23:56:05 UTC (rev 244812)
@@ -55,7 +55,7 @@
 
     void startTask(WebPageProxy&, WebProcessProxy&, uint64_t taskIdentifier, WebCore::ResourceRequest&&, SyncLoadCompletionHandler&&);
     void stopTask(WebPageProxy&, uint64_t taskIdentifier);
-    void stopAllTasksForPage(WebPageProxy&, WebProcessProxy*);
+    void stopAllTasksForPage(WebPageProxy&);
     void taskCompleted(WebURLSchemeTask&);
 
 protected:
@@ -67,7 +67,6 @@
     virtual void platformTaskCompleted(WebURLSchemeTask&) = 0;
 
     void removeTaskFromPageMap(uint64_t pageID, uint64_t taskID);
-    WebProcessProxy* processForTaskIdentifier(uint64_t) const;
 
     uint64_t m_identifier;
 

Modified: trunk/Source/WebKit/UIProcess/WebURLSchemeTask.h (244811 => 244812)


--- trunk/Source/WebKit/UIProcess/WebURLSchemeTask.h	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Source/WebKit/UIProcess/WebURLSchemeTask.h	2019-04-30 23:56:05 UTC (rev 244812)
@@ -58,7 +58,6 @@
 
     uint64_t identifier() const { return m_identifier; }
     uint64_t pageID() const { return m_pageIdentifier; }
-    WebProcessProxy* process() const { return m_process.get(); }
 
     const WebCore::ResourceRequest& request() const { return m_request; }
 

Modified: trunk/Tools/ChangeLog (244811 => 244812)


--- trunk/Tools/ChangeLog	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Tools/ChangeLog	2019-04-30 23:56:05 UTC (rev 244812)
@@ -1,5 +1,18 @@
 2019-04-30  Chris Dumez  <[email protected]>
 
+        Unreviewed, rolling out r244802.
+
+        Caused an API test failure
+
+        Reverted changeset:
+
+        "Regression(PSON) URL scheme handlers can no longer respond
+        asynchronously"
+        https://bugs.webkit.org/show_bug.cgi?id=197426
+        https://trac.webkit.org/changeset/244802
+
+2019-04-30  Chris Dumez  <[email protected]>
+
         Regression(PSON) URL scheme handlers can no longer respond asynchronously
         https://bugs.webkit.org/show_bug.cgi?id=197426
         <rdar://problem/50256169>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (244811 => 244812)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-04-30 23:37:27 UTC (rev 244811)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-04-30 23:56:05 UTC (rev 244812)
@@ -48,7 +48,6 @@
 #import <WebKit/_WKProcessPoolConfiguration.h>
 #import <WebKit/_WKWebsiteDataStoreConfiguration.h>
 #import <WebKit/_WKWebsitePolicies.h>
-#import <wtf/BlockPtr.h>
 #import <wtf/Deque.h>
 #import <wtf/HashMap.h>
 #import <wtf/HashSet.h>
@@ -239,8 +238,6 @@
     const char* _bytes;
     HashMap<String, String> _redirects;
     HashMap<String, RetainPtr<NSData>> _dataMappings;
-    HashSet<id <WKURLSchemeTask>> _runningTasks;
-    bool _shouldRespondAsynchronously;
 }
 - (instancetype)initWithBytes:(const char*)bytes;
 - (void)addRedirectFromURLString:(NSString *)sourceURLString toURLString:(NSString *)destinationURLString;
@@ -266,29 +263,8 @@
     _dataMappings.set(urlString, [NSData dataWithBytesNoCopy:(void*)data length:strlen(data) freeWhenDone:NO]);
 }
 
-- (void)setShouldRespondAsynchronously:(BOOL)value
-{
-    _shouldRespondAsynchronously = value;
-}
-
 - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)task
 {
-    if ([(id<WKURLSchemeTaskPrivate>)task _requestOnlyIfCached]) {
-        [task didFailWithError:[NSError errorWithDomain:@"TestWebKitAPI" code:1 userInfo:nil]];
-        return;
-    }
-
-    _runningTasks.add(task);
-
-    auto doAsynchronouslyIfNecessary = [self, strongSelf = retainPtr(self), task = retainPtr(task)](Function<void(id <WKURLSchemeTask>)>&& f, double delay) {
-        if (!_shouldRespondAsynchronously)
-            return f(task.get());
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_main_queue(), makeBlockPtr([self, strongSelf, task, f = WTFMove(f)] {
-            if (_runningTasks.contains(task.get()))
-                f(task.get());
-        }).get());
-    };
-
     NSURL *finalURL = task.request.URL;
     auto target = _redirects.get(task.request.URL.absoluteString);
     if (!target.isEmpty()) {
@@ -300,30 +276,27 @@
         [(id<WKURLSchemeTaskPrivate>)task _didPerformRedirection:redirectResponse.get() newRequest:request.get()];
     }
 
-    doAsynchronouslyIfNecessary([finalURL = retainPtr(finalURL)](id <WKURLSchemeTask> task) {
-        RetainPtr<NSURLResponse> response = adoptNS([[NSURLResponse alloc] initWithURL:finalURL.get() MIMEType:@"text/html" expectedContentLength:1 textEncodingName:nil]);
-        [task didReceiveResponse:response.get()];
-    }, 0.1);
+    if ([(id<WKURLSchemeTaskPrivate>)task _requestOnlyIfCached]) {
+        [task didFailWithError:[NSError errorWithDomain:@"TestWebKitAPI" code:1 userInfo:nil]];
+        return;
+    }
 
-    doAsynchronouslyIfNecessary([self, finalURL = retainPtr(finalURL)](id <WKURLSchemeTask> task) {
-        if (auto data = "" absoluteString]))
-            [task didReceiveData:data.get()];
-        else if (_bytes) {
-            RetainPtr<NSData> data = "" alloc] initWithBytesNoCopy:(void *)_bytes length:strlen(_bytes) freeWhenDone:NO]);
-            [task didReceiveData:data.get()];
-        } else
-            [task didReceiveData:[@"Hello" dataUsingEncoding:NSUTF8StringEncoding]];
-    }, 0.2);
+    RetainPtr<NSURLResponse> response = adoptNS([[NSURLResponse alloc] initWithURL:finalURL MIMEType:@"text/html" expectedContentLength:1 textEncodingName:nil]);
+    [task didReceiveResponse:response.get()];
 
-    doAsynchronouslyIfNecessary([self](id <WKURLSchemeTask> task) {
-        [task didFinish];
-        _runningTasks.remove(task);
-    }, 0.3);
+    if (auto data = "" absoluteString]))
+        [task didReceiveData:data.get()];
+    else if (_bytes) {
+        RetainPtr<NSData> data = "" alloc] initWithBytesNoCopy:(void *)_bytes length:strlen(_bytes) freeWhenDone:NO]);
+        [task didReceiveData:data.get()];
+    } else
+        [task didReceiveData:[@"Hello" dataUsingEncoding:NSUTF8StringEncoding]];
+
+    [task didFinish];
 }
 
 - (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)task
 {
-    _runningTasks.remove(task);
 }
 
 @end
@@ -498,8 +471,7 @@
     return processPoolConfiguration;
 }
 
-enum class SchemeHandlerShouldBeAsync { No, Yes };
-static void runBasicTest(SchemeHandlerShouldBeAsync schemeHandlerShouldBeAsync)
+TEST(ProcessSwap, Basic)
 {
     auto processPoolConfiguration = psonProcessPoolConfiguration();
     auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
@@ -507,7 +479,6 @@
     auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     [webViewConfiguration setProcessPool:processPool.get()];
     auto handler = adoptNS([[PSONScheme alloc] init]);
-    [handler setShouldRespondAsynchronously:(schemeHandlerShouldBeAsync == SchemeHandlerShouldBeAsync::Yes)];
     [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
 
     auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
@@ -545,16 +516,6 @@
     EXPECT_EQ(numberOfDecidePolicyCalls, 3);
 }
 
-TEST(ProcessSwap, Basic)
-{
-    runBasicTest(SchemeHandlerShouldBeAsync::No);
-}
-
-TEST(ProcessSwap, BasicWithAsyncSchemeHandler)
-{
-    runBasicTest(SchemeHandlerShouldBeAsync::Yes);
-}
-
 TEST(ProcessSwap, LoadAfterPolicyDecision)
 {
     auto processPoolConfiguration = psonProcessPoolConfiguration();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to