Calling setZoom in webextension page overriding New tab wont work
Reported by
juraj.ma...@gmail.com,
Feb 25 2017
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Steps to reproduce the problem: 1. Install provided webextension 2. Open New tab 3. Exception is thrown and zoom level is not changed What is the expected behavior? Zoom level is changed to random between 1.1 to 2.1 What went wrong? Zoom level is not changed and exception is thrown: "Unchecked runtime.lastError while running tabs.setZoom: Cannot access a chrome:// URL" When the new tab is opened, extension page dial.html is loaded but the url bar is cleared. This means that current url is chrome://newtab and not chrome-extension://caihdpebnhjcllokjdkgainjhnlaeiki/dial.html You can see that when you access extension page with questionmark at the end, it will work because it wont clear url: chrome-extension://caihdpebnhjcllokjdkgainjhnlaeiki/dial.html? Did this work before? No Does this work in other browsers? Yes Chrome version: 56.0.2924.87 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 24.0 r0
,
Feb 25 2017
New tab page has chrome://newtab/ url internally, and if I interpret the source code correctly [1], this use case isn't checked at all in IsRestrictedUrl function called from TabsSetZoomFunction::RunAsync(). As a consequence, setZoom is likely not the only thing to fail on a newtab replacement page. [1]: https://cs.chromium.org/chromium/src/extensions/common/permissions/permissions_data.cc?l=87&rcl=01ec0eb96c86261cb26219d4bd227f98d94c06d5
,
Feb 27 2017
,
Feb 28 2017
,
Mar 1 2017
Tested on windows 10 , windows 7 using chrome M56 #56.0.2924.87 and followed the steps below: 1. Launched chrome and navigated to chrome://extensions and loaded the given extensions. 2. Opened new tab and observed as attached in screenshot. @juraj.masiar--Could you please check if the attached screenshot and confirm us if this is the issue or help us by providing the expected result screenshot , that would help us in traiging the issue better. Thanks!
,
Mar 1 2017
Yes, as you can see in the screenshot, the zoom level is wrongly set (1.643 is not equal to 1). If it was working the numbers would match.
But in this example there is no "correct" screenshot since I used random generator to provide random zoom (so that you have low chance to accidentally match the target zoom level).
But all you need to do is call 'setZoom' and then in callback call 'getZoom' to validate that zoom was changed (you can check source code for 'dial.js', it's just 8 lines of code).
If you need a simple test case with some assert then all you need is one line of code:
document.addEventListener('DOMContentLoaded', () => chrome.tabs.setZoom(2, () => chrome.tabs.getZoom(zoom => assertTrue(zoom === 2))));
,
Mar 1 2017
Thank you for providing more feedback. Adding requester "hdodda@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 9 2017
Able to reproduce the issue on windows 7, Ubuntu 14.04 and Mac 10.12.3 using chrome version 56.0.2924.87 and canary 59.0.3035.0. This is non regression issue from M47.M45 and prior versions not showing any zoom level and error.' Hence marking it as Untriaged to get more inputs from dev. Thanks, |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by juraj.ma...@gmail.com
, Feb 25 20173.7 KB
3.7 KB Download