On some websites when pageshow is fired contentDocument is not correctly
populated.
I have an extension which shows the problem available at
http://foobartastic.com/moz/pageshowprob.xpi
Here's how to use it:
go to cvmarket.lt
open the sidebar
click the show the bug button
watch your error console for the error messages the extension shows
(make sure you can see chrome error messages).
The real core of the extension is in AttackRunner.js. What the runner
does is it clones the current tab. Then, on page show (which is fired
after everything is loaded), it checks if the number of forms
(and elements in each form) is the same in the new tab as in the current
tab. If they're not then an error is show in the error console.
This does bug does not show up on all sites but does show up on some.
cvmarket.lt is a solid test case.
I'd really appreciate any advice,
Tom
Just wanted to provide some more information from some testing I did
using smaug's advice on IRC.
When I get the pageshow event, event.originalTarget (an HTMLDocument
object) has incorrectly populated forms. Just like browser.contentDocument.
What the heck is going on here!??!
Tom
Have you tried using DOMContentLoaded instead of pageshow?
- Brian
Hi Brian,
Sorry for not replying for so long.
I don't think DOMContentLoaded is a solution as it happens before
pageshow (pageshow is the last event). So if ContentDocument doesn't
work by pageshow how can it work during DOMContentLoaded, right?
Thanks for the thought, though.
Tom