add support for image as baseURI, also make revert faster

If document.baseURI is an image, handle that properlly.
Also make the revert faster