public void DisallowBadSchemasReferences(string url) { var ctx = new PortableHtmlContext(); Assert.AreNotEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState(url, false)); Assert.AreNotEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState(url, true)); }
public void DisallowNonTrustedAbsoluteLinks() { var ctx = new PortableHtmlContext(); Assert.AreNotEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com/x", false)); Assert.AreNotEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com/x", true)); }
public void CanTrustAllLinks() { var ctx = new PortableHtmlContext(); ctx.Level |= PortableHtmlStrictLevel.TrustAllLinks; Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com:8080/x", false)); Assert.AreNotEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com:8080/x", true)); }
public void AllowTrustedAbsoluteLinks() { var ctx = new PortableHtmlContext(); ctx.TrustedHosts.Add("my.site.com"); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com/x", false)); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com/x", true)); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com:8080/x", false)); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com:8080/x", true)); }
public void AllowBaseUriAbsoluteLinks() { var ctx = new PortableHtmlContext(); ctx.BaseUri = new Uri("https://my.site.com:443/u"); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com/x", false)); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com/x", true)); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com:8080/x", false)); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("http://my.site.com:8080/x", true)); }
public void DisallowDataOnAnchors() { var ctx = new PortableHtmlContext(); Assert.AreNotEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("data:image", false)); }
public void AllowDataOnImages() { var ctx = new PortableHtmlContext(); Assert.AreEqual(PortableHtmlSchemaErorr.None, ctx.GetUriTrustState("data:image", true)); }