This test shows how GreaseMonkey incorrectly fires a script twice when a replaceState() call is made before the window is loaded.

Code in this document:

	window.history.replaceState(document.url, null);

Test with this GM script:

// ==UserScript==
// @name        Greasemonkey pushState test
// @namespace
// @include*
// @run-at		document-start
// ==/UserScript==
alert("Greasemonkey test running: "+document.getElementsByTagName('BODY').length);

The problem does NOT happen when I monitor the window's "load" event rather than DOMContentLoaded.