Bug 1067721 - [e10s] "Save Snapshot As" dialog box doesn't open
Here's the code in question:
http://hg.mozilla.org/mozilla-central/file/366d06412304/browser/base/content/nsContextMenu.js#l1039
So this doesn't work because "this.target", in this function, is a
CPOW, and we can't seem to call ctxDraw.drawImage with a CPOW.
The simplest solution, I think, to send a message down to the content
process, and have it send back the data URI to be saved - thereby making
this a bit more asynchronous.
I think that should be straight-forward. Let me give that a shot.
Yeah! It works. Ok, so how about a test?
I can stash saveImageURL, overwrite it, and return it on test shutdown, which would allow me to capture the DataURI.
So, the test should: Play a <video> video, call
saveVideoFrameAsImage, and then we should make sure that our
saveImageURL is eventually called with a dataURL as the first argument.
Worth it?
Totally worth it. And I don't even need to overwrite saveImageURL -
there's this MockTransfer thing that browser_save_video.js uses that I
can re-use.
Yikes! In browser/base/content/test/general/head.js, promisePopupEvent had this:
if (popup.state = endState)
return Promise.resolve();
That's bad bad bad! That'll always evaluate to true. Luckily, it looks like nobody was using this function (until me, that is).
Tests done - try-push:
Huh… failing bc1 test. My test. It's failing out there. Grrrr...
Ok, I've found a way to simulate right click with a frame script that seems to work. Re-pushing:
Seems… to … be OK?
Tried felipe's document.popupNode idea, but it looks like it's not
defined. My regression test fails in the e10s case. Didn't try in the
non-e10s case. Not too surprising though - looks like popupNode is on
the outs:
https://developer.mozilla.org/en-US/docs/Web/API/document.popupNode
Woo, landed!