New issue
Advanced search Search tips

Issue 599398 link

Starred by 4 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Extension background page, after mirroring, never reports correct screen resolution

Project Member Reported by joi@chromium.org, Mar 31 2016

Issue description

Version: Reproduces in at least Chrome 49 and 50
OS: Mac OS X

What steps will reproduce the problem?
(1) In an extension background page, add the checkRes function below, and run it. It should report the correct screen size of the primary monitor, as long as you have not previously mirrored.
(2) Mirror your screen e.g. by connecting an external projector via HDMI.
(3) Now run checkRes again in an extension background page, it will report the resolution of the mirrored screen, as will the code that reports from a regular browser tab.
(4) Now stop mirroring (disconnect the HDMI cable).
(5) Run checkRes again. Now the background page still reports the resolution that it reported while you were mirroring, whereas a normal tab (any tab, not just one created at this point) will report the correct resolution of the primary screen.

What is the expected output?

Both a background page and a regular tab on the primary monitor should report the correct screen resolution of the primary monitor.

What do you see instead?

The background page gets "stuck" on reporting the resolution that was in place while you were mirroring to e.g. a projector, and never seems to recover.

Interestingly, normal screen resolution changes (e.g. changing resolution through System Preferences) are picked up correctly by the background page.


Here is a code snippet that can be called from a background page to illustrate the problem. Note that this snippet creates a new window and injects code into its tab, but injecting into any existing tab would give the same behavior.

function checkRes() {
    console.log("screen.height from extension: " + screen.height);
    console.log("screen.width from extension: " + screen.width);
    chrome.windows.create({url: "https://google.com"}, function(win) {
        chrome.tabs.executeScript(win.tabs[0].id, {
            code: "[screen.height, screen.width]"
        }, function (resultsArray) {
            console.log("screen.height from tab: " + resultsArray[0][0]);
            console.log("screen.width from tab: " + resultsArray[0][1]);
            chrome.windows.remove(win.id);
        });
    });
}

 

Comment 1 by joi@chromium.org, Mar 31 2016

Cc: finnur@chromium.org
finnur@ suggested that I check with this fiddle if things work correctly in a normal tab, and I can confirm that they do: http://jsfiddle.net/krWLA/3/

CCing finnur@ as I believe he also has an idea who might be the right assignee.

Comment 2 by finnur@chromium.org, Mar 31 2016

Labels: -Pri-3 Pri-2
Owner: rdevlin....@chromium.org
Status: Assigned (was: Untriaged)
Assigning to Devlin, he might have some insight or know who does.

Sign in to add a comment