mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-10 09:16:20 +02:00
Support for safe external scripts via explicit whitelist.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
33
tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php
Normal file
33
tests/HTMLPurifier/HTMLModule/SafeScriptingTest.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class HTMLPurifier_HTMLModule_SafeScriptingTest extends HTMLPurifier_HTMLModuleHarness
|
||||
{
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$this->config->set('HTML.SafeScripting', array('http://localhost/foo.js'));
|
||||
}
|
||||
|
||||
function testMinimal() {
|
||||
$this->assertResult(
|
||||
'<script></script>',
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
function testGood() {
|
||||
$this->assertResult(
|
||||
'<script type="text/javascript" src="http://localhost/foo.js" />'
|
||||
);
|
||||
}
|
||||
|
||||
function testBad() {
|
||||
$this->assertResult(
|
||||
'<script type="text/javascript" src="http://localhost/foobar.js" />',
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
Reference in New Issue
Block a user