Extension context menu persists across sessions if background persistent = false
Reported by
thd...@gmail.com,
Sep 12
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36 Steps to reproduce the problem: 1. Unzip and install context-menu.zip 2. Restart Chrome What is the expected behavior? When you restart Chrome, the context menu should not show anymore because it was created inside the onInstalled listener. What went wrong? The context menu persists across browser sessions (i.e., after a restart) even though it was created inside the onInstalled listener. Did this work before? N/A Does this work in other browsers? Yes Chrome version: 69.0.3497.92 Channel: stable OS Version: 10.0 Flash Version: The gist of the issue is that when you set 'persistent' to false for the background property, for some reason the onInstalled event is fired every time Chrome is loaded, which doesn't follow the definition of "onInstalled".
,
Sep 17
Tried testing the issue on win-10 using chrome reported version #69.0.3497.92 but failed to install the attached context-menu file due to the error as in the attached screen cast. thdoan@ - Could you please check the attached screen cast and provide any other sample test extension file to triage the issue from TE-end. Thanks...!!
,
Sep 17
My bad, use this attachment instead (it was missing a comma before the 'persistent' property).
,
Sep 17
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 12
Tried testing the issue on chrome version# 69.0.3497.100 using Windows-10 with steps mentioned below: 1) Launched chrome reported version and installed the extension provided in comment# 3. 2) Restarted the browser, right clicked on the webpage, and in the context menu options able to see "Context Menu Test" option @Reporter: Please find the attached screencast for your reference and provide your feedback on it which help in further triaging it. If possible could you please provide screencast of the issue which help in better understanding it. Thanks!
,
Oct 12
You already reproduced the issue in your screencast. The issue is: why is the context menu created when you restart Chrome? The context menu should only be built when you first install the extension (onInstalled). Now set persistent to true in the manifest and try again -- the behavior is different. The behavior in Firefox Quantum is correct; the behavior in Chrome with persistent = false is incorrect.
,
Oct 12
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Nov 14
Able to reproduce the issue on Mac 10.13.6, Win-10 and Ubuntu 17.10 using chrome latest stable #70.0.3538.102 and latest canary #72.0.3610.0. This is a non-regression issue as it is observed from M60 old builds. Hence, marking it as untriaged to get more inputs from dev team. Thanks...!!
,
Nov 16
Interesting! I can reproduce this as well, and can confirm that it's only when the background page is set to persistent: false. That's very strange. thdoan@, do you happen to know if the behavior is the same for an installed extension from the store (versus an unpacked extension)? lazyboy@, do you think you'd be able to take a look at this when you get a moment? Might be something to fix in our lazy background context code.
,
Nov 16
@rdevlin.... yes, the behavior is the same for an installed extension. In fact, I only became aware of this issue because my own extension from the store was creating the context menu from inside the onInstalled listener only, but the context menu was still displayed even after Chrome is restarted. At first I thought this was the normal behavior (because even the official sample code for contextMenus created the menus onInstalled), so when the context menu started disappearing on restart in Firefox Quantum after I ported my extension I submitted a bug report with the Mozilla team, and they came back saying well, actually, this is behaving as expected since the context menu was being created only when the extension is first installed. This sample code should be updated so setUpContextMenus() is called onStartup, not onInstalled: https://github.com/GoogleChrome/chrome-app-samples/blob/master/samples/context-menu/main.js
,
Nov 17
This isn't dispatching onInstalled, rather event pages + context menus are being written to storage. That's how our implementation always was afaik. references: https://cs.chromium.org/chromium/src/chrome/browser/extensions/api/context_menus/context_menus_api_helpers.h?rcl=dd0605104189c6ab82f6268b89a5fd2ea12feeb8&l=164 https://cs.chromium.org/chromium/src/chrome/browser/extensions/menu_manager.cc?rcl=fc8ec946cf8aad22bb135d46f349bf262e322716&l=818 |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by gov...@chromium.org
, Sep 12