Created attachment 634688 [details]
testcase (crashes Firefox when loaded)
Messy testcase. I guess some state is not visible to serializeDOMAsScript :/
Created attachment 634689 [details]
Aryeh, can you please take a look?
This was bug 762183 part 4. It added a while loop to change selectedNode's value, but didn't account for the fact that it might set it to null. Just need a null check here.
Created attachment 634809 [details] [diff] [review]
On Windows: bp-591d4a60-3df4-4f94-8c9f-12fb72120620.