New issue
Advanced search Search tips

Issue 912020 link

Starred by 2 users

Issue metadata

Status: Unconfirmed
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Taking screenshot is not possible if the page is still loading (Extension API)

Reported by rhour...@gmail.com, Dec 5

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0

Steps to reproduce the problem:
I have created a small extension that takes screenshots using both `Page.captureScreenshot` and `captureVisibleTab` calls which behave similarly here. 
I also attached a test page with a simulated slow resource. 

1. Install the attached extension in chrome browser and open the background console window to be able to see logs of the function call time and callback time.
2. Navigate to a page with slow resources in the head (in this case slowHead.html)
3. Click on the camera icon to take a screenshot.
** In the console you can see the time before and after the screenshot call. Usually, it's milliseconds. If the page is loading then it takes as long as the page loads.
4. The extension opens a new tab after the result is received from the `Page.captureScreenshot` with the screenshot image.

What is the expected behavior?
I have a chrome extension that usually loads pages and takes screenshot after a certain time. I would expect to get a white page if the page is not loaded at that time. Instead, I have to wait until the page is loaded to do so.

What went wrong?
I first noticed the problem when some of the pages I wanted to take a screenshot of were loading resources from a different country and were too slow which caused the screenshot callback to take 3 minutes before it got executed. I think there's some kind of timeout as 3 minutes here.

In the attached reproducer I could simulate a resource that needs max 30 seconds to load and the sample output was.
12/5/2018, 10:30:07 AM before send command
12/5/2018, 10:30:07 AM before captureVisibleTab
12/5/2018, 10:30:35 AM callback of captureVisibleTab
12/5/2018, 10:30:36 AM callback of send command

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 71.0.3578.80 (Official Build) beta (64-bit) (cohort: Beta)  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 26.0 r0

* I'm not really sure if this worked before but I remember taking white screenshots of pages that were not loaded yet. Does this not work anymore?

* I've seen the same behavior using Ubuntu.

* Is it intended to not get any screenshot until the page is loaded?

* Is it possible to get any other value that represents that the page is still loading like null or undefined? Or a white screenshot?

* I have opened this issue before with the wrong component and after the recommendation I opened here again. https://bugs.chromium.org/p/chromium/issues/detail?id=910512
Please check the other comments there. It seems to not be expected to behave like this.
 
captureScreenshot.zip
4.4 KB Download
slowHead.zip
442 bytes Download
Labels: Needs-Triage-M71
Cc: susan.boorgula@chromium.org
Components: Platform>Extensions
Labels: Triaged-ET Needs-Feedback
rhourieh@ Thanks for the issue.

Tested this issue on Windows 10 on the reported version 71.0.3578.80 and the latest Canary 73.0.3632.0 by following the below steps.

1. Launched Chrome and added the given extension.
2. Loaded the slowHead.html page and clicked on the camera icon.
3. After few seconds, the result is in a new tab with output as 'Page Loaded'.
Attached is the screen cast for reference.

Request you to check and confirm if anything is missed from our end in triaging the issue.
Also request you to provide of the screen cast of the issue observed, which will help in better understanding.

Thanks..
912020.mp4
657 KB View Download
Thank you Susan for the screencast. It's as expected. The only extra thing that is not shown here is the console output that is usually shown in the extension background console. That shows as I mentioned earlier something like this

12/5/2018, 10:30:07 AM before send command
12/5/2018, 10:30:07 AM before captureVisibleTab
12/5/2018, 10:30:35 AM callback of captureVisibleTab
12/5/2018, 10:30:36 AM callback of send command

Which means it's not possible to take an immediate screenshot if the page is still loading and get a white screenshot to represent the real state of that tab.

So, my questions are
* Is it intended to not get any tab screenshot until the page is loaded?
* Is it possible to get any other value that represents that there is still a page loading like null or undefined? (In this case the programmer needs to keep retry taking screenshot until the page is loaded)
* Is it possible to get the real white screenshot of that tab instead of waiting x seconds until the page finishes loading?
Project Member

Comment 4 by sheriffbot@chromium.org, Dec 6

Labels: -Needs-Feedback
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
Is it possible to get any update on this issue please? 
If it is intended to be like this, we can't use the screen capture API without being blocked and in worst case never get a result before we run into some internal timeout.

Sign in to add a comment