Changeset 2328 in subversion


Ignore:
Timestamp:
Mar 4, 2009 5:02:55 AM (4 years ago)
Author:
thomasb
Message:

Add tests for external stylesheet handling

Location:
trunk/roundcubemail/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/tests/mailfunc.php

    r2324 r2328  
    5656    $this->assertPattern('/Subscription form/', $html, "Include <form> contents"); 
    5757    $this->assertPattern('/<!-- input not allowed -->/', $html, "No input elements allowed"); 
     58    $this->assertPattern('/<!-- link not allowed -->/', $html, "No external links allowed"); 
    5859    $this->assertPattern('/<a[^>]+ target="_blank">/', $html, "Set target to _blank"); 
    5960    $this->assertTrue($GLOBALS['REMOTE_OBJECTS'], "Remote object detected"); 
    6061     
    6162    // render HTML in safe mode 
    62     $html2 = rcmail_print_body($part, array('safe' => true)); 
     63    $html2 = rcmail_html4inline(rcmail_print_body($part, array('safe' => true)), 'foo'); 
    6364     
    6465    $this->assertPattern('/<style [^>]+>/', $html2, "Allow styles in safe mode"); 
    6566    $this->assertPattern('#src="http://evilsite.net/mailings/ex3.jpg"#', $html2, "Allow external images in HTML (safe mode)"); 
    6667    $this->assertPattern("#url\('http://evilsite.net/newsletter/image/bg/bg-64.jpg'\)#", $html2, "Allow external images in CSS (safe mode)"); 
     68     
     69    $css = '<link rel="stylesheet" type="text/css" href="./bin/modcss.php?u='.urlencode('http://anysite.net/styles/mail.css').'&amp;c=foo"'; 
     70    $this->assertPattern('#'.preg_quote($css).'#', $html2, "Filter external styleseehts with bin/modcss.php"); 
    6771  } 
    6872 
  • trunk/roundcubemail/tests/src/htmlbody.txt

    r2323 r2328  
    44<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> 
    55<title>RoundCube Test Message</title> 
     6<link rel="stylesheet" type="text/css" href="http://anysite.net/styles/mail.css"> 
    67<style type="text/css"> 
    78 
Note: See TracChangeset for help on using the changeset viewer.