• Frédéric Wang's avatar
    Reland "Make custom protocol handlers work with service workers' fetch event" · 1eabba76
    Frédéric Wang authored
    This relands [1] but removing the test
    RegisterProtocolHandlerAndServiceWorkerInterceptor.DoNotRegisterFetchListener
    which is flaky on mac and not essential for testing the bug fix.
    
    [1] https://chromium-review.googlesource.com/c/chromium/src/+/2379672
    
    Original change's description:
    > [Sheriff] Revert "Make custom protocol handlers work with service workers' fetch event"
    >
    > This reverts commit c007dfe1.
    >
    > Reason for revert: RegisterProtocolHandlerAndServiceWorkerInterceptor.DoNotRegisterFetchListener is very flaky on mac (and possibly elsewhere).
    >
    > Sample failure:
    > [ RUN      ] RegisterProtocolHandlerAndServiceWorkerInterceptor.DoNotRegisterFetchListener
    > [23479:30231:1019/055809.421386:WARNING:notification_platform_bridge_mac.mm(374)] AlertNotificationService: XPC connection invalidated.
    > [23479:775:1019/055809.917320:ERROR:device_event_log_impl.cc(211)] [05:58:09.906] FIDO: touch_id_context.mm:127 Touch ID authenticator unavailable because keychain-access-group entitlement is missing or incorrect
    > [23479:96771:1019/055810.044487:WARNING:embedded_test_server.cc(667)] Request not handled. Returning 404: /favicon.ico
    > [23479:775:1019/055810.218450:INFO:CONSOLE(0)] "Failed to launch 'web+html:path' because the scheme does not have a registered handler.", source:  (0)
    > ../../content/public/test/browser_test_base.cc:702: Failure
    > Failed
    > RunLoop::Run() timed out.
    > Stack trace:
    > 0   browser_tests                       0x0000000110d3e9c2 _ZN4base8internal7InvokerINS0_9BindStateIZNS_4test20ScopedRunLoopTimeoutC1ERKNS_8LocationENS_9TimeDeltaENS_17RepeatingCallbackIFNSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEvEEEE3$_0JS5_SI_EEEFvvEE3RunEPNS0_13BindStateBaseE + 290
    > 1   browser_tests                       0x0000000110c5916f base::(anonymous namespace)::OnRunLoopTimeout(base::RunLoop*, base::OnceCallback<void ()>) + 31
    > 2   browser_tests                       0x0000000110c5a1a3 base::internal::Invoker<base::internal::BindState<void (*)(base::RunLoop*, base::OnceCallback<void ()>), base::internal::UnretainedWrapper<base::RunLoop>, base::RepeatingCallback<void ()> >, void ()>::RunOnce(base::internal::BindStateBase*) + 67
    > 3   browser_tests                       0x000000010cf23a83 void base::internal::CancelableCallbackImpl<base::OnceCallback<void ()> >::ForwardOnce<>() + 35
    > 4   browser_tests                       0x000000010cf23b34 base::internal::Invoker<base::internal::BindState<void (base::internal::CancelableCallbackImpl<base::OnceCallback<void ()> >::*)(), base::WeakPtr<base::internal::CancelableCallbackImpl<base::OnceCallback<void ()> > > >, void ()>::RunOnce(base::internal::BindStateBase*) + 148
    > 5   browser_tests                       0x0000000110c7a946 base::TaskAnnotator::RunTask(char const*, base::PendingTask*) + 310
    > 6   browser_tests                       0x0000000110c8fb55 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow*) + 405
    > 7   browser_tests                       0x0000000110c8f858 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() + 168
    > 8   browser_tests                       0x0000000110ce29a1 ___ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv_block_invoke + 49
    > 9   browser_tests                       0x0000000110cdb662 base::mac::CallWithEHFrame(void () block_pointer) + 10
    > 10  browser_tests                       0x0000000110ce223f base::MessagePumpCFRunLoopBase::RunWorkSource(void*) + 63
    > 11  CoreFoundation                      0x00007fff38600884 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    >
    > Original change's description:
    > > Make custom protocol handlers work with service workers' fetch event
    > >
    > > When a service worker intercepts a page that is later registered as a
    > > handler for a custom scheme via navigator.registerProtocolHandler, and
    > > if one clicks a link with this custom scheme, then the service worker
    > > is only able to intercept the page after reload. This CL fixes that
    > > bug by allowing the service worker to intercept the page after
    > > registering the custom scheme.
    > >
    > > A new browser unit test is added to verify this fix. This also makes
    > > the following manual WPT tests pass (*):
    > >   protocol-handler-fragment-manual.https.html
    > >   protocol-handler-path-manual.https.html
    > >   protocol-handler-query-manual.https.html
    > >
    > > (*) https://w3c-test.org/html/webappapis/system-state-and-capabilities/the-navigator-object/
    > >
    > > Bug: 522370
    > > Change-Id: I95eda9025885838665e9735ac9f47a3d65d89aa8
    > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2379672
    > > Commit-Queue: Frédéric Wang <fwang@igalia.com>
    > > Reviewed-by: Dominick Ng <dominickn@chromium.org>
    > > Reviewed-by: Matt Falkenhagen <falken@chromium.org>
    > > Cr-Commit-Position: refs/heads/master@{#818416}
    >
    > TBR=falken@chromium.org,fwang@igalia.com,dominickn@chromium.org
    >
    > Change-Id: I026705f0116f3e0d684c8b1d80847aec85ec36db
    > No-Presubmit: true
    > No-Tree-Checks: true
    > No-Try: true
    > Bug: 522370
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485837
    > Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
    > Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#818511}
    
    
    Bug: 522370
    Change-Id: Id30235a64a5a6a5c5d783ee686df321c7c853b16
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2487107Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
    Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
    Commit-Queue: Frédéric Wang <fwang@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#820255}
    1eabba76
chrome_content_browser_client.cc 229 KB