[application] HasMainDocument() should consider actual entry point

Application::HasMainDocument() should consider the application entry point (whether application has actually started from 'app.main') rather than just check presence of this field in the manifest.
Otherwise we'll have a bug if the manifest has an invalid value at 'app.main' and the corresponding app has started from a different entry point.

A side change: 2 Application methods were rearranged in .cc file accordingly to their declaration order.