Remove Non-Deterministic ExtensionFunction WebContents, Browser, and WindowController accessors |
||
Issue descriptionThere are a number of different methods on ExtensionFunction and friends (ChromeAsyncExtensionFunction, ChromeExtensionFunctionDetails) that return a WebContents, Browser, WindowController, or similar object. Unfortunately, most of these (with the exception of render_frame_host() and GetSenderWebContents()) are very non-deterministic, returning any number of possible values (including some that might only be vaguely related to the extension). We should remove these, and update callers to use GetSenderWebContents() where possible, or to otherwise explicitly get a different value (e.g., BrowserList::GetLastActive() to get the last active browser). I'll own this for now, but patches welcome.
,
Feb 8 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/4ef78a87a98e35103f8f8be2f4501acc485174e9 commit 4ef78a87a98e35103f8f8be2f4501acc485174e9 Author: Devlin Cronin <rdevlin.cronin@chromium.org> Date: Thu Feb 08 00:34:42 2018 [Extension Functions] Move GetCurrentBrowser to details only Remove ChromeAsyncExtensionFunction::GetCurrentBrowser() and update callers to always use ChromeExtensionFunctionDetails::GetCurrentBrowser(). This is functionally the same as what was happening before, but now we don't have to duplicate the function (and very long comment) in both chrome_extension_function and chrome_extension_function_details. No behavior change. Bug: 809194 Bug: 634140 Change-Id: I4379fc0c2d22800ceed7c6355828719ec81cde1b Reviewed-on: https://chromium-review.googlesource.com/902086 Commit-Queue: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org> Cr-Commit-Position: refs/heads/master@{#535214} [modify] https://crrev.com/4ef78a87a98e35103f8f8be2f4501acc485174e9/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc [modify] https://crrev.com/4ef78a87a98e35103f8f8be2f4501acc485174e9/chrome/browser/extensions/api/cookies/cookies_api.cc [modify] https://crrev.com/4ef78a87a98e35103f8f8be2f4501acc485174e9/chrome/browser/extensions/api/tabs/tabs_api.cc [modify] https://crrev.com/4ef78a87a98e35103f8f8be2f4501acc485174e9/chrome/browser/extensions/chrome_extension_function.cc [modify] https://crrev.com/4ef78a87a98e35103f8f8be2f4501acc485174e9/chrome/browser/extensions/chrome_extension_function.h
,
May 8 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/eb0fa56ceccbc4d9b483d4d9045ae8c619a62d49 commit eb0fa56ceccbc4d9b483d4d9045ae8c619a62d49 Author: Devlin Cronin <rdevlin.cronin@chromium.org> Date: Tue May 08 14:02:46 2018 [Extensions] Remove GetCurrentBrowser() usage from cookies API GetCurrentBrowser() is pretty non-deterministic (returning various different browser objects depending on different circumstances). It looks like the cookies API only needs it to get at the profile associated with the extension function. Update this to just use GetProfile() instead. Bug: 809194 Change-Id: I745d17313ca77da43f164f06d55eb3ddd1840901 Reviewed-on: https://chromium-review.googlesource.com/1048392 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#556785} [modify] https://crrev.com/eb0fa56ceccbc4d9b483d4d9045ae8c619a62d49/chrome/browser/extensions/api/cookies/cookies_api.cc
,
Aug 2
,
Aug 9
r556785 apparently caused bug 872156 , PTAL.
,
Aug 13
@5 thanks, woxxom@! Replied on that bug. |
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, Feb 5 2018