User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:126.96.36.199) Gecko/20110420 Firefox/3.6.17
Build Identifier: Firefox 3.6.17, Firefox 4.0.0
JS exception "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE" occurs if property document.activeElement refers to DOM element from previous document. We discovered this bug in following scenario.
Website contains two pages. First page is login page with two input elements for username and password and "submit" button. Second page is a page accessing document.activeElement.
User click on "submit" button (first step) and then on input element with username (second step). JS exception mentioned above occurs when the second page (loaded after submitting the first page) tries to access document.activeElement property.
I can reproduce this bug easily in Firefox with Firebug.
Steps to Reproduce:
1. load simple login page (username, password, submit button)
2. fill username and password
3. click on "submit" button (active element is button)
4. click on input element before the second page appears (active element is input element)
5. wait until the second page is loaded
[Exception... "Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [nsIDOMNSDocument.activeElement]" nsresult: "0x80004005
(NS_ERROR_FAILURE)" location: "JS frame ::
<TOP_LEVEL> :: line 24" data: no]
No js exception. Property document.activeElement refers to any DOM element in the current document or is null.
This bug is OS and version independent.
- Firefox 3.6.17, Firefox 4.0.0
- Windows 7 x64, Windows 7 x86, MacOs 10.6
A testcase would be great.
But the implementation is certainly wrong.
(And I reviewed the code :( )
Patch with tests coming....
Created attachment 531662 [details] [diff] [review]
This should do it. Make sure .activeElement doesn't throw, ever.
Comment on attachment 531662 [details] [diff] [review]
Thank you for fast solution. I apologize for missing testcase. We haven't finished simplified testcase when this bug was reported.