Service Worker still runs when JS is disabled
Reported by
n...@medium.com,
Jul 29 2016
|
|||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Example URL: Steps to reproduce the problem: 1. Go to a website with a Service Worker, so that the service worker is installed 2. Go to settings and disable JavaScript 3. Visit the site again What is the expected behavior? JavaScript is disabled, so the service worker should not run What went wrong? The Service Worker runs anyway Does it occur on multiple sites: N/A Is it a problem with a plugin? N/A Did this work before? N/A Does this work in other browsers? Yes Chrome version: 51.0.2704.103 Channel: n/a OS Version: OS X 10.11.5 Flash Version: Shockwave Flash 22.0 r0 This works correctly in Firefox This puts the user in a bad, wedged state: the service worker is still running, and we can't turn it off because we need JS to turn it off.
,
Jul 29 2016
https://googlechrome.github.io/samples/service-worker/mock-responses/index.html Notice that if you visit the page, then disable js, then revisit it, you will see console logs from the serviceworker running
,
Aug 1 2016
Tested the same on mac 10.11.5 chrome version 52.0.2743.82 and canary 54.0.2814.0 - Observed that console logs show that the service worker is running - Please find the screenshot But the same is observed in Firefox as well- screenshot attached Could you please test the same in other browsers and update the thread with your observations.
,
Aug 5 2016
,
Aug 9 2016
Removing from bisect queue since the issue is not reproducible as per #3. nick@ Are you still seeing the same issue in latest chrome Stable-52.0.2743.116?
,
Aug 10 2016
yes, i'm still able to reproduce the problem at 52.0.2743.116
,
Aug 10 2016
I could confirm this could be reproduced. I guess the disable-javascript flag should be checked before the request is handled by SW. horo-san, do you know anything about the flag?
,
Aug 10 2016
Scripts in usual documents are restricted at https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp?rcl=1470626560&l=313, but SW uses WorkerOrWorkletScriptController instead of ScriptController which doesn't have the check. I think we have to add it somehow.
,
Aug 10 2016
This is a duplicate of Issue 606959 but comes to a different conclusion than that issue. So I'll let whoever takes this issue work out how to merge the two bugs.
,
Aug 10 2016
That issue seems like it reaches the same conclusion, not sure what part you think it's different? I would be fine with de-duping this against that bug.
,
Aug 10 2016
Ran into this a few times building PWAs. I'd personally favor doing a check for JS being disabled before handing off to SW (it does still start per 606959), however there may be good reasons for that not being feasible.
,
Aug 12 2016
Issue 606959 has been merged into this issue.
,
Aug 12 2016
It's easier way not to launch the SW when the disabling flags is on, but, if my understanding is correct, when the flag gets turned on after launching, the SW script will handle requests though JS is disabled. I think it's better to disable to execute JS than disable to start SW. I'll take over this issue from falken@. # Anyway, why is this Hotlist-DevRel? I guess SW can be disabled by using "Bypass for network". Should I keep this issue higher priority?
,
Aug 12 2016
Here's a better example of why I think the service workers should be disabled when JS is disabled: https://github.com/GoogleChrome/application-shell (Demo: https://app-shell.appspot.com/) DevRel has been encouraging a PWA architecture where the service worker loads a "shell", and then JS in the shell loads the content. In the demo, if you have JS disabled and no service worker, the page loads OK. If you have JS disabled and a service worker installed, the service worker serves a broken shell.
,
Sep 27 2016
,
Sep 27 2016
I'm asking how to check the settings of disabling JS at https://cs.chromium.org/chromium/src/chrome/browser/chrome_content_browser_client.cc?sq=package:chromium&rcl=1474946434&l=1764 .
,
Sep 30 2016
Now I'm working at https://crrev.com/2377603002, and I'm thinking how to set an icon to indicate javascripts are disabled.
,
Oct 6 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ce8af8812b8de0246975c932063b1e03ed570068 commit ce8af8812b8de0246975c932063b1e03ed570068 Author: shimazu <shimazu@chromium.org> Date: Thu Oct 06 23:49:21 2016 Disable ServiceWorker when JS is disabled This patch restricts the service worker when JavaScript is disabled by checking the settings in ChromeContentBrowserClient::AllowServiceWorker(). BUG= 632823 Review-Url: https://codereview.chromium.org/2377603002 Cr-Commit-Position: refs/heads/master@{#423745} [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/chrome_content_browser_client.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/chrome_service_worker_browsertest.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/content_settings/tab_specific_content_settings.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/content_settings/tab_specific_content_settings.h [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/content/browser/service_worker/service_worker_dispatcher_host.cc
,
Oct 7 2016
,
Oct 10 2016
Recheck this on Chrome Version 55.0.2883.5 on Windows 10, MAC 10.11.6, Ubuntu 14.04. Followed the below steps: 1) Installed chrome and navigated to the test URL provided in Comment#2 2) Navigated to Dev tools and observe that Service workers are displayed in console (Attachment - Service Worker - Java Script Enabled.png) 3) Disabled javaScript from Dev tools>Settings 4) Reloaded the Test URL. 5) In console observed that Only a single event was displayed in Console Log (Attachment - Service Worker - Java Script Disabled.png) @shimazu: Request you to please check the attached screen shots if this is the expected behavior. Thanks.!
,
Oct 10 2016
,
Oct 11 2016
I can repro it. It works fine if JS is disabled from chrome://settings/content, but it doesn't from DevTools. DevTools folks: is there any kind of difference between the two?
,
Oct 17 2016
Since this is mostly fixed in M55 (good work!), can we close this one and open a new bug to track the remaining work of honoring the DevTools setting? (IMO from a privacy perspective the user setting is more important and the P1) shimazu: Also I'd recommend to CC someone directly with your question.
,
Oct 17 2016
Sounds good. I created another issue ( Issue 656516 ). > shimazu: Also I'd recommend to CC someone directly with your question. I'll do it next time, thanks:)
,
Oct 27 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ce8af8812b8de0246975c932063b1e03ed570068 commit ce8af8812b8de0246975c932063b1e03ed570068 Author: shimazu <shimazu@chromium.org> Date: Thu Oct 06 23:49:21 2016 Disable ServiceWorker when JS is disabled This patch restricts the service worker when JavaScript is disabled by checking the settings in ChromeContentBrowserClient::AllowServiceWorker(). BUG= 632823 Review-Url: https://codereview.chromium.org/2377603002 Cr-Commit-Position: refs/heads/master@{#423745} [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/chrome_content_browser_client.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/chrome_service_worker_browsertest.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/content_settings/tab_specific_content_settings.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/content_settings/tab_specific_content_settings.h [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc [modify] https://crrev.com/ce8af8812b8de0246975c932063b1e03ed570068/content/browser/service_worker/service_worker_dispatcher_host.cc
,
Nov 4 2016
[Automated comment] removing mislabelled merge-merged-2840 |
|||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||
Comment 1 by ligim...@chromium.org
, Jul 29 2016