Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Initial navigation blocked if website has service worker that enables navigation preload #156

Closed
9 tasks done
steffenweber opened this issue May 21, 2019 · 13 comments
Closed
9 tasks done
Labels
Chromium specific to Chromium/Chrome external an external factor is involved wontfix This will not be worked on

Comments

@steffenweber
Copy link

steffenweber commented May 21, 2019

Prerequisites

  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
  • This is not a support issue or a question
    • Support issues and questions are handled at /r/uMatrix
  • I tried to reproduce the issue when...
    • uMatrix is the only extension
    • uMatrix with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uMatrix
  • I checked the documentation to understand that the issue I report is not a normal behavior
  • I used the logger to rule out that the issue is caused by my ruleset

Description

If a website has a service worker that enables Navigation Preload then such navigation preload requests are blocked by uMatrix. This then causes the page to fail to load.

A specific URL where the issue occurs

https://www.computerbase.de/

Steps to Reproduce

  1. Open https://www.computerbase.de/ to initialize the service worker
  2. In the same tab, do an omnibox search for "computerbase forum"
  3. On the Google search results, click the first link (should point to https://www.computerbase.de/forum/)

What should happen: The navigation preload request for https://www.computerbase.de/forum/ should pass the checks of uMatrix. The page should load fine.

What actually happens: The navigation preload request for https://www.computerbase.de/forum/ is blocked by uMatrix (see the screenshot below). This causes our service worker to show an "offline" fallback/error page.

(Reproducing this issue is not 100% reliable. Afaik, Chrome only sends navigation preload requests when the service worker is not already running. Maybe you need more than one try to reproduce this issue. You can try to manually stop the computerbase.de service worker in the "Application" tab of the Chrome developer tools between steps 2 and 3.)

This issue was originally reported by one of our users here: https://www.computerbase.de/forum/threads/login-probleme-seit-14-mai-der-aktive-benutzer-hat-sich-geaendert.1872153/post-22667228

Ruleset

(I've used a fresh Chrome profile and didn't add/delete any rules. )

Supporting evidence

Screenshot from 2019-05-21 16-03-24-fs8

Screenshot from 2019-05-21 16-06-40-fs8

Your environment

  • uMatrix version: 1.3.16 / 1.3.17rc1
  • Browser Name and version: Chrome 74.0.3729.131 / 75.0.3770.27
  • Operating System and version: Gentoo Linux (x86_64)
@uBlock-user uBlock-user added the unable to reproduce cannot reproduce the given issue label May 21, 2019
@uBlock-user
Copy link
Contributor

What actually happens: The navigation preload request for https://www.computerbase.de/forum/ is blocked by uMatrix (see the screenshot below). This causes our service worker to show an "offline" fallback/error page.

Site loads fine, no such offline error page is shown. Secondly, no such "service worker navigation preload request" error appears in the console either.

@gorhill
Copy link
Member

gorhill commented May 21, 2019

I am able to reproduce.

@gorhill gorhill removed the unable to reproduce cannot reproduce the given issue label May 21, 2019
@uBlock-user uBlock-user added bug Something isn't working Chromium specific to Chromium/Chrome labels May 21, 2019
@uBlock-user
Copy link
Contributor

As per chrome://serviceworker-internals, navigation preload enabled is set to false, this is why it seems I can't reproduce.

@steffenweber
Copy link
Author

steffenweber commented May 21, 2019

Screen capture of the issue in Chrome 75 Beta and uMatrix 1.3.17rc1: https://youtu.be/r7qKTpD-fc0

(I've just read that you are now able to reproduce the issue but maybe the video can still be useful. 🙂)

@gorhill
Copy link
Member

gorhill commented May 21, 2019

Unfortunately, Chrome is passing bad information to uMatrix:

a

It's telling uMatrix that the network request of type other to https://www.computerbase.de/forum/ originates from https://www.google.com. There is nothing in there that could be used to fall back from this bad information. The only solution I can think of for a uMatrix user is to create a rule from the logger such as:

a

I consider this bad information to be a Chromium bug.

@gorhill gorhill added the external an external factor is involved label May 21, 2019
@uBlock-user uBlock-user removed the bug Something isn't working label May 21, 2019
@mikhaelkh
Copy link

mikhaelkh commented May 21, 2019

When I search uMatrix in DuckDuckGo then click on https://github.com/gorhill/uMatrix to open in new tab, COOKIE is blocked and I'm not logged in. Page refresh helps, COOKIE no longer blocked.
I have

* * cookie block
* 1st-party cookie allow

It seems to not be specific to Service Worker with Navigation Preload.

@uBlock-user
Copy link
Contributor

uBlock-user commented May 21, 2019

Ah yes, I can reproduce that. Seems to be occuring on very first load only and from the past one day.

@uBlock-user
Copy link
Contributor

uBlock-user commented May 21, 2019

@mikhaelkh I believe documentUrl commit appears to be the cause.

@gorhill
Copy link
Member

gorhill commented May 21, 2019

That commit just made the browser bug more prominent, it's happening also because Chrome is feeding bad information to uBO. However I think I can mitigate this one because the request type is main_frame, and in that case it just make sense to have the originator set the same as the request URL. This won't fix the issue here, but this will fix that spurious cookie deletion one.

@uBlock-user
Copy link
Contributor

This won't fix the issue here, but this will fix that spurious cookie deletion one.

Thanks, this spurious deletion is literally trolling me on youtube and github where I'm losing my cookie based settings randomly every now and then and me having to set them again and again.

gorhill added a commit to gorhill/uMatrix that referenced this issue May 21, 2019
Related discussion/issue:
- uBlockOrigin/uMatrix-issues#156 (comment)
- uBlockOrigin/uMatrix-issues#155

Due to a Chromium issue about not providing the proper context
information, a negative side-effect was introduced with fix
to #155. This commit will force the originator of a network
request of type `main_frame` to be that of the request URL
itself, i.e. the originator of a top-level document request
is the requested document itself.
@gorhill
Copy link
Member

gorhill commented May 22, 2019

Closing since there is nothing which can be done to work around this Chromium issue -- users will have to create rules specific to Chromium to deal with this.

@gorhill gorhill closed this as completed May 22, 2019
@steffenweber
Copy link
Author

You said that "Chrome is passing bad information to uMatrix". This sounds like a bug in Chrome to me. Could you report this issue at https://crbug.com?

I'm not familiar with the code of uMatrix or the WebExtensions API.

@steffenweber
Copy link
Author

I have filed a Chrome bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=965960

Please leave a comment if I've missed something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Chromium specific to Chromium/Chrome external an external factor is involved wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants