New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 696155 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Calling setZoom in webextension page overriding New tab wont work

Reported by juraj.ma...@gmail.com, Feb 25 2017

Issue description

UserAgent: 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

 
the test webextension:
NewTabReplacement.zip
3.7 KB Download

Comment 2 by woxxom@gmail.com, 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

Comment 3 by rbyers@chromium.org, Feb 27 2017

Components: Platform>Extensions>API
Labels: -Hotlist-Interop
Labels: Needs-Triage-M56
Cc: hdodda@chromium.org
Labels: Needs-Feedback
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!
696155.PNG
54.3 KB View Download
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))));
Project Member

Comment 7 by sheriffbot@chromium.org, Mar 1 2017

Labels: -Needs-Feedback
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
Cc: kavvaru@chromium.org
Labels: -Needs-Triage-M56 M-59 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
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