Importing forbidden resources makes canvas disappear
Reported by
hakerh403@gmail.com,
Aug 17
|
|||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 Steps to reproduce the problem: 1. Create a canvas 2. Append it to the document.body or document.documentElement 3. In an asynchronous loop re-append it to the parent element 4. Then try to access an url that is not allowed by CORS policy Access-Control-Allow-Origin What is the expected behavior? The canvas should be visible always. What went wrong? After the network error is logged to the console, the canvas starts to disappear and appear randomly. Did this work before? N/A Chrome version: 67.0.3396.87 Channel: stable OS Version: 6.3 Flash Version: /
,
Aug 19
,
Aug 21
doesn't reproduce for me. Can you provide a less convoluted test case please?
,
Aug 21
Some parts of the test case scripts may look redundant or useless, but if I modify a single character from any of the test case scripts provided, the canvas stops disappearing. This bug is probably some kind of race condition or something like that. Make sure to test the script on Windows x64 using the reported Chrome version. Also, make sure to enable the Internet connection on the machine where the script is being tested, in order to allow the script to cause CORS violation and then to make the canvas disappear. The issue may not be related to canvas only, but also to other elements, but it is hard to test, because of the instability of the test case.
,
Aug 21
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
,
Aug 21
I do see the CORS violations, but no flickering :/
,
Aug 21
Not sure what may cause the flickering. Maybe it is related to graphical driver, so I'm providing gpu.htm file. It is almost surely a race condition of some sort. If I change timeout from b.js and d.js to 0ms, then no flickering happens. I can suggest to try to adjust timeouts it b.js, d.js, and c.js scripts in order to fulfill whatever conditions cause flickering. The canvas disappears at the beginning of loading f.js and appears after loading it, no matter how long the timeout is there. Replacing the timeout in f.js with an infinite loop causes the canvas to stay invisible. Pausing the script using devtools inspector while the canvas is invisible sometimes causes the canvas to appear, sometimes doesn't. Executing `canvas.getClientRects()` on the canvas while it is invisible returns an empty array, but it is present in the elements tab of the devtools and all computed style properties suggest that is should be visible. If I need to provide any other useful info, let me know.
,
Aug 22
Is this related to HTML imports?
,
Aug 22
Here is a very simplified test case. Hope it helps. If still unable to reproduce, try to adjust timeouts.
,
Aug 23
I mean, I can imagine that this is a timing issue - document.write() should wipe the DOM, so you do remove the canvas, and add it back later. Flickering is within the realm of what's possible. I don't think this is related to CORS however.
,
Aug 23
It took a look at index.html briefly. It is unclear to me how Blink>DOM is related. It looks an timing issue to me.
,
Aug 23
Re C#10: It's not related to `document.write`. I'm attaching test case without document.write, which still reproduces the flickering. I did few more tests. Importing resources that allows all origins still causes flickering. I agree that it is probably unrelated to CORS. It seems that the issue is only related to HTML imports feature.
,
Aug 23
appendChild(node) first removes node from its parent, so you're still constantly removing the canvas from the document which I think is what causes the flickering
,
Aug 23
Yes, but it shouldn't flicker, like it doesn't flicker in other browsers. When JavaScript code gives the control to the event loop, the canvas is already appended. It disappears while loading another script, not while executing the scripts that re-appends it.
,
Oct 12
We succeeded to create a 100% reproducible test-case. To make it portable, we tested under Windows 10 virtual machine. The virtual machine can be downloaded here: https://drive.google.com/open?id=1hAorCiVTv06Ej6ZYca_UAkRxvh8nIQpI VirtualBox is needed to run the machine. Tested on different host machines and different operating systems. It reproduces everywhere using the provided virtual machine. Can someone from dev team take a look at the virtual machine and try to run the script from there (environment is already prepared). Once confirmed, this issue can be further triaged. The issue with disappearing canvas significantly affects some pages, because if page imports external resources multiple times, each time canvas (and probably other elements) disappears. Here we are also providing a screencast on how to run the virtual machine and test the script. Can someone now confirm the issue? Thanks.
,
Oct 15
This seems to be more a layout/DOM problem than a canvas. But I'm not sure.
,
Oct 15
As jochen explained in comment 13 re-adding the canvas to the document first removes it and then re-adds it. That combined with the external stylehseets is what is causing the flickering behavior you're seeing. Try to avoid constantly re-adding it or use request animation frame to have more control over when it gets re-painted. |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by e...@chromium.org
, Aug 18