final HtmlPage page = (HtmlPage) getWindow().getWebWindow().getEnclosedPage();
final URL url = page.getFullyQualifiedUrl(uri);
if (!page.getWebResponse().getRequestSettings().getUrl().getHost().equals(url.getHost())) {
throw Context.reportRuntimeError("Not authorized url: " + url);
}
final JavaScriptJob job = new DownloadBehaviorJob(url, callback);
page.getEnclosingWindow().getJobManager().addJob(job, page);
}