Created by: piotr-cz
At this moment, service worker registers a callback to the windows' load event.
In some cases (like when there are no images on page), this happens after load event has been fired previously and so callback isn't invoked.
This PR adds a check to see if the document is already loaded (document.readyState === 'complete') and if so, invokes callback manually.