⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271174 in webkit


Ignore:
Timestamp:
Jan 5, 2021, 2:30:31 PM (6 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, reverting r271169.

Caused
TestWebKitAPI.WebKit2.SpeechRecognitionErrorWhenStartingAudioCaptureOnDifferentPage
to time out on macOS.

Reverted changeset:

"Stop speech recognition if page becomes invisible"
https://bugs.webkit.org/show_bug.cgi?id=220073
https://trac.webkit.org/changeset/271169

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r271171 r271174  
     12021-01-05  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, reverting r271169.
     4
     5        Caused
     6        TestWebKitAPI.WebKit2.SpeechRecognitionErrorWhenStartingAudioCaptureOnDifferentPage
     7        to time out on macOS.
     8
     9        Reverted changeset:
     10
     11        "Stop speech recognition if page becomes invisible"
     12        https://bugs.webkit.org/show_bug.cgi?id=220073
     13        https://trac.webkit.org/changeset/271169
     14
    1152021-01-05  Alex Christensen  <achristensen@webkit.org>
    216
  • trunk/Source/WebKit/UIProcess/SpeechRecognitionPermissionManager.cpp

    r271169 r271174  
    162162    ASSERT(m_userPermissionCheck == CheckResult::Granted);
    163163
    164     if (!m_page.isViewVisible()) {
    165         completeCurrentRequest(SpeechRecognitionPermissionDecision::Deny);
    166         return;
    167     }
    168 
    169164    completeCurrentRequest(SpeechRecognitionPermissionDecision::Grant);
    170165}
  • trunk/Source/WebKit/UIProcess/SpeechRecognitionServer.cpp

    r271169 r271174  
    169169}
    170170
    171 void SpeechRecognitionServer::abortForPageIsBecomingInvisible()
    172 {
    173     if (!m_recognizer)
    174         return;
    175 
    176     auto currentClientIdentifier = m_recognizer->currentClientIdentifier();
    177     if (!currentClientIdentifier)
    178         return;
    179 
    180     auto error = WebCore::SpeechRecognitionError { WebCore::SpeechRecognitionErrorType::Aborted, "Page is no longer visible"_s };
    181     sendUpdate(*currentClientIdentifier, WebCore::SpeechRecognitionUpdateType::Error, error);
    182     m_recognizer->reset();
    183 }
    184 
    185171void SpeechRecognitionServer::sendUpdate(WebCore::SpeechRecognitionConnectionClientIdentifier clientIdentifier, WebCore::SpeechRecognitionUpdateType type, Optional<WebCore::SpeechRecognitionError> error, Optional<Vector<WebCore::SpeechRecognitionResultData>> result)
    186172{
  • trunk/Source/WebKit/UIProcess/SpeechRecognitionServer.h

    r271169 r271174  
    6565    void invalidate(WebCore::SpeechRecognitionConnectionClientIdentifier);
    6666    void mute();
    67     void abortForPageIsBecomingInvisible();
    6867
    6968private:
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r271171 r271174  
    19961996        updateCurrentModifierState();
    19971997
    1998     if ((m_potentiallyChangedActivityStateFlags & ActivityState::IsVisible)) {
    1999         if (isViewVisible())
    2000             viewIsBecomingVisible();
    2001         else
    2002             m_process->pageIsBecomingInvisible(m_webPageID);
    2003     }
     1998    if ((m_potentiallyChangedActivityStateFlags & ActivityState::IsVisible) && isViewVisible())
     1999        viewIsBecomingVisible();
    20042000
    20052001    bool isNowInWindow = (changed & ActivityState::IsInWindow) && isInWindow();
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r271169 r271174  
    17891789}
    17901790
    1791 void WebProcessProxy::pageIsBecomingInvisible(WebCore::PageIdentifier identifier)
    1792 {
    1793     if (auto server = m_speechRecognitionServerMap.get(identifier))
    1794         server->abortForPageIsBecomingInvisible();
    1795 }
    1796 
    17971791#if PLATFORM(WATCHOS)
    17981792
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r271169 r271174  
    406406#endif
    407407    void pageMutedStateChanged(WebCore::PageIdentifier, WebCore::MediaProducer::MutedStateFlags);
    408     void pageIsBecomingInvisible(WebCore::PageIdentifier);
    409408
    410409protected:
  • trunk/Tools/ChangeLog

    r271173 r271174  
     12021-01-05  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, reverting r271169.
     4
     5        Caused
     6        TestWebKitAPI.WebKit2.SpeechRecognitionErrorWhenStartingAudioCaptureOnDifferentPage
     7        to time out on macOS.
     8
     9        Reverted changeset:
     10
     11        "Stop speech recognition if page becomes invisible"
     12        https://bugs.webkit.org/show_bug.cgi?id=220073
     13        https://trac.webkit.org/changeset/271169
     14
    1152021-01-05  Ryan Haddad  <ryanhaddad@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SpeechRecognition.mm

    r271169 r271174  
    168168}
    169169
    170 // FIXME: enable this test on iOS when https://webkit.org/b/175204 is fixed.
    171 #if PLATFORM(MAC)
    172 
    173 TEST(WebKit2, SpeechRecognitionPageBecomesInvisible)
    174 {
    175     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    176     auto handler = adoptNS([[SpeechRecognitionMessageHandler alloc] init]);
    177     [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"testHandler"];
    178     auto preferences = [configuration preferences];
    179     preferences._mockCaptureDevicesEnabled = YES;
    180     preferences._speechRecognitionEnabled = YES;
    181     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
    182     auto delegate = adoptNS([[SpeechRecognitionPermissionUIDelegate alloc] init]);
    183     [webView setUIDelegate:delegate.get()];
    184 
    185     // Page is visible.
    186     shouldGrantPermissionRequest = true;
    187     receivedScriptMessage = false;
    188     [webView synchronouslyLoadTestPageNamed:@"speechrecognition-basic"];
    189     [webView stringByEvaluatingJavaScript:@"start()"];
    190     TestWebKitAPI::Util::run(&receivedScriptMessage);
    191     EXPECT_WK_STREQ(@"Start", [lastScriptMessage body]);
    192 
    193     // Hide page.
    194     receivedScriptMessage = false;
    195 #if PLATFORM(MAC)
    196     [webView.get().window setIsVisible:NO];
    197 #else
    198     webView.get().window.hidden = YES;
    199 #endif
    200     TestWebKitAPI::Util::run(&receivedScriptMessage);
    201     EXPECT_WK_STREQ(@"Error: aborted - Page is no longer visible", [lastScriptMessage body]);
    202 
    203     // Page is invisible.
    204     receivedScriptMessage = false;
    205     [webView evaluateJavaScript:@"start()" completionHandler:nil];
    206     TestWebKitAPI::Util::run(&receivedScriptMessage);
    207     EXPECT_WK_STREQ(@"Error: not-allowed - Permission check failed", [lastScriptMessage body]);
    208 }
    209 
    210 #endif
    211 
    212170} // namespace TestWebKitAPI
Note: See TracChangeset for help on using the changeset viewer.