If you add a gradient to the canvas and use fill() a gradient is drawn, even if there is no path.
Created attachment 25999 [details] example an example. you should see a green box.
Created attachment 26000 [details] fixes canvas gradient on cg just don't call GraphicsContext::fillPath() or GraphicsContext::strokePath() if the path is empty.
Comment on attachment 26000 [details] fixes canvas gradient on cg r=me
landed in r39276.
One pixel-test fails. I'm prety sure that this failing pixel-test is wrong and should be deleted. It makes no sense to fill somthing with a gradient if the path is empty. This behavior is against the spec of HTML 5. It was added in https://bugs.webkit.org/show_bug.cgi?id=14642 becauses of http://adam.yanalunas.com/projects/reflect/. It could be that we didn't get fillRect to work with gradients at this time. To get reflect back, just delete the webkit hack on the script.
Created attachment 26004 [details] delete wrong pixel-test gradient-emty-path delete wrong test.
landed the LayoutTest fix in r39288.