Fix a case of a dangling last parser action

If the parser encounters an EOF, but it still waiting for resource
loading, make sure there is a happens-before edge from the last
parser action to the actions performed on load completion,
e.g. running deferred scripts.
Widen the event-action extent in certain resource loading events

`ResourceLoader::releaseResources` may trigger events, thus must be
called from within the scope of an event-action.
Mark dispatch of the document `readystatechange` event