Loading on shadow pages should not count UseCounter |
||||||||||||||||
Issue descriptionCopied from https://bugs.chromium.org/p/chromium/issues/detail?id=376039#c30 "WorkerGlobalScope doesn't have a frame, but the shadow page has a frame. Therefore, if loader code calls UseCounter on the shadow page, it could wrongly be recorded."
,
Apr 21 2017
I'll confirm if this actually happens.
,
Apr 21 2017
I confirmed service worker startup counts the UseCouter::kPageVisits as follows: Confirmation procedure: 1) Add LOG(ERROR) to UseCounter::DidCommitLoad() to print a given url. 2) Go to chrome://serviceworker-internals. 3) Press "Start" button on one of registrations. 4) Check the stderr. A log should be printed with a service worker script url.
,
Apr 21 2017
,
Apr 21 2017
,
Apr 21 2017
Hmm... the SW update check also counts the UseCounter::kPageVisits: Confirmation procedure: 1) Add LOG(ERROR) to UseCounter::DidCommitLoad() to print a given url. 2) Go to a page that uses a service worker. 3) Open DevTools's "Application" tab. 4) Click "Update" link on "Service Workers" section 5) Check the stderr. A log should be printed with a service worker script url.
,
Apr 21 2017
Yes it'd do. Loading code also calls various UseCounter code which hit Shadow Page. What'd be the expected behavior here by the way? Some usage counters would never be counted if we completely disable use counting there.
,
Apr 21 2017
Chatted offline. So all the use counter would need to be routed back to the worker context. (For context: I'm trying to remove frame dependency from the loading code, but was still thinking about the possibility to keep having a shadow 'document' in some cases, but that might still skew the use counter. I'll think about it a little more)
,
Apr 21 2017
,
Sep 12 2017
,
Feb 9 2018
Issue 810429 has been merged into this issue.
,
Feb 9 2018
,
Feb 9 2018
,
Feb 9 2018
I could work on this but I would appreciate a little bit more information given that I don't have much knowledge on workers. Thanks
,
Feb 9 2018
If there's a way to tell if the given document is a worker shadow page (IsWorkerShadowPage()) or something, then we can stop counting kPageVisits and other features on it.
,
Feb 9 2018
,
Feb 12 2018
In UseCounter::DidCommitLoad(LocalFrame* frame), I tried to check frame->GetDocument()->IsWorkerOrWorkletGlobalScope() for page whose url is https://www.facebook.com/sw?s=push Somehow I got false. Is there other way to check if the page is a worker shadow page? Thanks
,
Feb 13 2018
What if in WorkerShadowPage, I inform it's WebView to not log UseCounter, then in WebViewImpl, it can inform the Page to not log UseCounter, then in Page::DidCommitLoad, UseCounter PageVisits won't get logged. My question is, are there other features that could be counted on the shadow page even though they are not supposed to be?
,
Feb 14 2018
Thanks for picking this up! Reg: #18 IsWorkerOrWorkletGlobalScope returns true for the actual global space for the worker that runs on the worker thread, so it's not useful for the shadow page. Anyways I'll take a look...
,
Feb 14 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7890f24a44b6b5bf31243e87900c0192d2373697 commit 7890f24a44b6b5bf31243e87900c0192d2373697 Author: Luna Lu <loonybear@chromium.org> Date: Wed Feb 14 16:41:48 2018 Add a flag in Settings for UseCounter to avoid measuring shadow pages. Shadow page has a frame and upon service worker startup, UseCounter will count page visits. This CL adds a flag "is_shadow_page_" in Settings and sets the flag to be true in WorkerPageShadow initialization (by default the flag's value is false). In UseCounter it checks for shadow pages and drop counts for shadow pages. Note that this flag will eventually go away since browser side use counter does not have problems with workers. So once the blink side use counter is removed, this change can be undone. This change has also been verified to work locally. Bug: 694880 Change-Id: I1cbe857d776591098bbbbf256ef8aa546c399af5 Reviewed-on: https://chromium-review.googlesource.com/917028 Commit-Queue: Luna Lu <loonybear@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Commit-Position: refs/heads/master@{#536736} [modify] https://crrev.com/7890f24a44b6b5bf31243e87900c0192d2373697/content/browser/service_worker/service_worker_browsertest.cc [modify] https://crrev.com/7890f24a44b6b5bf31243e87900c0192d2373697/third_party/WebKit/Source/core/exported/WorkerShadowPage.cpp [modify] https://crrev.com/7890f24a44b6b5bf31243e87900c0192d2373697/third_party/WebKit/Source/core/frame/Settings.cpp [modify] https://crrev.com/7890f24a44b6b5bf31243e87900c0192d2373697/third_party/WebKit/Source/core/frame/Settings.h [modify] https://crrev.com/7890f24a44b6b5bf31243e87900c0192d2373697/third_party/WebKit/Source/core/frame/UseCounter.cpp
,
Feb 14 2018
This is an internal feature that doesn't affect the web. This feature touches UseCounter, which collects feature usage in the web (please see https://www.chromestatus.com/metrics/feature/popularity). The feature usage is calculated as (feature counts/ pagevisits). The current behaviour is wrong (pagevisits is inflated). So the public result is also wrong. I will verify the bug tomorrow on canary tomorrow. Thanks
,
Feb 14 2018
Thank you Luna. Please update the bug with canary result tomorrow. Also FYI, we've getting close to M65 stable launch so merge bar will be high going forward.
,
Feb 14 2018
This bug requires manual review: M65 has already been promoted to the beta branch, so this requires manual review Please contact the milestone owner if you have questions. Owners: cmasso@(Android), cmasso@(iOS), bhthompson@(ChromeOS), govind@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Feb 15 2018
Verified on 66.0.3348.0. Works as expected. Thanks
,
Feb 15 2018
Approving merge to M65 branch 3325 based on comments #23 and #26. Please merge ASAP. Thank you.
,
Feb 15 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5665233d75c6613266a70dd985e12c22aa3a6363 commit 5665233d75c6613266a70dd985e12c22aa3a6363 Author: Luna Lu <loonybear@chromium.org> Date: Thu Feb 15 21:55:31 2018 Add a flag in Settings for UseCounter to avoid measuring shadow pages. Shadow page has a frame and upon service worker startup, UseCounter will count page visits. This CL adds a flag "is_shadow_page_" in Settings and sets the flag to be true in WorkerPageShadow initialization (by default the flag's value is false). In UseCounter it checks for shadow pages and drop counts for shadow pages. Note that this flag will eventually go away since browser side use counter does not have problems with workers. So once the blink side use counter is removed, this change can be undone. This change has also been verified to work locally. Bug: 694880 Change-Id: I1cbe857d776591098bbbbf256ef8aa546c399af5 Reviewed-on: https://chromium-review.googlesource.com/917028 Commit-Queue: Luna Lu <loonybear@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#536736}(cherry picked from commit 7890f24a44b6b5bf31243e87900c0192d2373697) Reviewed-on: https://chromium-review.googlesource.com/922941 Reviewed-by: Luna Lu <loonybear@chromium.org> Cr-Commit-Position: refs/branch-heads/3325@{#482} Cr-Branched-From: bc084a8b5afa3744a74927344e304c02ae54189f-refs/heads/master@{#530369} [modify] https://crrev.com/5665233d75c6613266a70dd985e12c22aa3a6363/content/browser/service_worker/service_worker_browsertest.cc [modify] https://crrev.com/5665233d75c6613266a70dd985e12c22aa3a6363/third_party/WebKit/Source/core/exported/WorkerShadowPage.cpp [modify] https://crrev.com/5665233d75c6613266a70dd985e12c22aa3a6363/third_party/WebKit/Source/core/frame/Settings.cpp [modify] https://crrev.com/5665233d75c6613266a70dd985e12c22aa3a6363/third_party/WebKit/Source/core/frame/Settings.h [modify] https://crrev.com/5665233d75c6613266a70dd985e12c22aa3a6363/third_party/WebKit/Source/core/frame/UseCounter.cpp
,
Feb 15 2018
Thanks!
,
Feb 15 2018
|
||||||||||||||||
►
Sign in to add a comment |
||||||||||||||||
Comment 1 by nhiroki@chromium.org
, Feb 22 2017Summary: Investigate if a shadow page affects UseCounter (was: Investigate if a shadow page affects on UseCounter)