Skip to content

Commit

Permalink
Merge pull request #29 from slackhq/ssandler_test_on_4_102
Browse files Browse the repository at this point in the history
fix one typechecker error on hhvm 4.102, and run tests on this release
  • Loading branch information
ssandler authored Aug 18, 2021
2 parents 61e5880 + a422e71 commit 00f187b
Show file tree
Hide file tree
Showing 26 changed files with 3 additions and 36 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
os: [ ubuntu ]
hhvm:
- '4.80'
- '4.102'
runs-on: ${{matrix.os}}-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .hhconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ hackfmt.line_width=120
hackfmt.add_trailing_commas=true
user_attributes=
allowed_decl_fixme_codes=2053,4047
allowed_fixme_codes_strict=2011,2049,2050,2053,4027,4047,4104,4107,4108,4110,4128,4135,4188,4240,4323
allowed_fixme_codes_strict=2011,2049,2050,2053,4027,4047,4104,4107,4108,4110,4128,4135,4188,4240,4323,4390
1 change: 0 additions & 1 deletion src/AttrDef/CSS.hack
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class HTMLPurifier_AttrDef_CSS extends HTMLPurifier\HTMLPurifier_AttrDef {
$definition = TypeAssert\instance_of(Definition\HTMLPurifier_CSSDefinition::class, $config->getCSSDefinition());
$allow_duplicates = $config->def->defaults["CSS.AllowDuplicates"];


// According to the CSS2.1 spec, the places where a
// non-delimiting semicolon can appear are in strings
// escape sequences. So here is some dumb hack to
Expand Down
1 change: 0 additions & 1 deletion src/AttrDef/CSS/Font.hack
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier\HTMLPurifier_AttrDef {
$final = ''; // output
$r = '';


for ($i = 0, $size = C\count($bits); $i < $size; $i++) {
if ($bits[$i] === '') {
continue;
Expand Down
1 change: 0 additions & 1 deletion src/AttrDef/CSS/FontFamily.hack
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use namespace HTMLPurifier\AttrDef;
use namespace HH\Lib\{C, Str};
use namespace Facebook\TypeSpec;


/**
* Validates a font family list according to CSS spec
*/
Expand Down
1 change: 0 additions & 1 deletion src/AttrDef/CSS/ListStyle.hack
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier\HTMLPurifier_AttrD
*/
protected dict<string, HTMLPurifier\HTMLPurifier_AttrDef> $info = dict[];


public function __construct(HTMLPurifier\HTMLPurifier_Config $_config) : void {
$this->info['list-style-type'] = new AttrDef\HTMLPurifier_AttrDef_Enum(
vec[
Expand Down
1 change: 1 addition & 0 deletions src/AttrDef/CSS/Number.hack
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier\HTMLPurifier_AttrDef
// FALLTHROUGH
case '+':
$number = Str\slice($number, 1);
// FALLTHROUGH
default: // Do nothing (required in newer hhvm versions)
}

Expand Down
1 change: 0 additions & 1 deletion src/AttrDef/URI.hack
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class HTMLPurifier_AttrDef_URI extends HTMLPurifier\HTMLPurifier_AttrDef

$ok = false;
do {

// generic validation
$result = $uri->validate($config, $context);
if (!$result) {
Expand Down
1 change: 0 additions & 1 deletion src/AttrValidator.hack
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class HTMLPurifier_AttrValidator {
// DEFINITION CALL
$defs = $definition->info[$token->name]->attr;


$context->register('CurrentAttr', false);

// iterate through all the attribute keypairs
Expand Down
1 change: 0 additions & 1 deletion src/Config.hack
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class HTMLPurifier_Config {
public bool $chatty = true;
private string $lock = '';


public function __construct(HTMLPurifier_ConfigSchema $definition, ?HTMLPurifier_PropertyList $parent = null) {
$parent = $parent ? $parent : $definition->defaultPlist;
$this->def = $definition;
Expand Down
2 changes: 0 additions & 2 deletions src/Definition/CSSDefinition.hack
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier\HTMLPurifier_Definition {
$this->info['border-right-color'] = $this->info['border-top-color'];
$border_color = $this->info['border-top-color'];


$this->info['background'] = new CSS\HTMLPurifier_AttrDef_CSS_Background($config);

$this->info['border-color'] = new CSS\HTMLPurifier_AttrDef_CSS_Multiple($border_color);
Expand Down Expand Up @@ -299,7 +298,6 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier\HTMLPurifier_Definition {
$this->info['max-width'] = $this->info['max-height'];
}


$this->info['text-decoration'] = new CSS\HTMLPurifier_AttrDef_CSS_TextDecoration();

$this->info['font-family'] = new CSS\HTMLPurifier_AttrDef_CSS_FontFamily();
Expand Down
5 changes: 0 additions & 5 deletions src/Definition/HTMLDefinition.hack
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,6 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier\HTMLPurifier_Definition {

}


// RAW CUSTOMIZATION STUFF --------------------------------------------

/**
Expand Down Expand Up @@ -1875,15 +1874,13 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier\HTMLPurifier_Definition {

private ?HTMLPurifier\HTMLPurifier_HTMLModule $_anonModule = null;


/**
* @param HTMLPurifier_Config $config
*/
protected function doSetup(HTMLPurifier\HTMLPurifier_Config $config): void {
$this->setupConfigStuff($config);
}


/**
* Sets up stuff based on config. We need a better way of doing this.
* @param HTMLPurifier_Config $config
Expand All @@ -1900,7 +1897,6 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier\HTMLPurifier_Definition {
throw new \Error('Cannot use non-block element as block wrapper', \E_USER_ERROR);
}


// support template text
$support =
"at the moment. Please implement the element you would like to support, and add the element to the HTMLDefinition constructor.";
Expand Down Expand Up @@ -2027,7 +2023,6 @@ class HTMLPurifier_HTMLDefinition extends HTMLPurifier\HTMLPurifier_Definition {
}
}


// setup injectors -----------------------------------------------------
foreach ($this->info_injector as $i => $injector) {
// if ($injector->checkNeeded($config) !== false) {
Expand Down
2 changes: 0 additions & 2 deletions src/Definition/URIDefinition.hack
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier\HTMLPurifier_Definition {
}
}


public function filter(inout HTMLPurifier\HTMLPurifier_URI $uri, HTMLPurifier\HTMLPurifier_Config $config, HTMLPurifier\HTMLPurifier_Context $context): bool {
foreach ($this->filters as $name => $f) {
$result = $f->filter(inout $uri, $config, $context);
Expand All @@ -108,7 +107,6 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier\HTMLPurifier_Definition {
return true;
}


public function postFilter(inout HTMLPurifier\HTMLPurifier_URI $uri, HTMLPurifier\HTMLPurifier_Config $config, HTMLPurifier\HTMLPurifier_Context $context): bool {
foreach ($this->postFilters as $name => $f) {
$result = $f->filter(inout $uri, $config, $context);
Expand Down
4 changes: 0 additions & 4 deletions src/Doctype.hack
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,22 @@ class HTMLPurifier_Doctype {
// // Full name of doctype
// public ?string $name;


// // * List of standard modules (string identifiers or literal objects)
// // * that this doctype uses
// public ?vec<string> $modules = vec[];


// // List of modules to use for tidying up code
// public ?vec<string> $tidyModules = vec[];

// // Is the language derived from XML (i.e. XHTML)?
// public ?bool $xml = true;


// // List of aliases for this doctype
// public ?vec<string> $aliases = vec[];

// // Public DTD identifier
// public ?string $dtdPublic;


// // System DTD identifier
// public ?string $dtdSystem;

Expand Down
1 change: 0 additions & 1 deletion src/Encoder.hack
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ class HTMLPurifier_Encoder {
// Codepoints outside the Unicode range are illegal
($mUcs4 > 0x10FFFF)
) {

} elseif (
0xFEFF != $mUcs4 && // omit BOM
// check for valid Char unicode codepoints
Expand Down
1 change: 0 additions & 1 deletion src/EntityParser.hack
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ class HTMLPurifier_EntityParser {
return '';
}


}
1 change: 0 additions & 1 deletion src/Generator.hack
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class HTMLPurifier_Generator {
//Configuration for the generator
protected HTMLPurifier_Config $config;


public function __construct(HTMLPurifier_Config $config, HTMLPurifier_Context $context) {
$this->config = $config;
$this->scriptFix = $config->def->defaults['Output.CommentScriptContents'];
Expand Down
1 change: 0 additions & 1 deletion src/HTMLModuleManager.hack
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class HTMLPurifier_HTMLModuleManager {

public HTMLPurifier_AttrTypes $attrTypes;


public function __construct()
{
// editable internal objects
Expand Down
1 change: 0 additions & 1 deletion src/Injector/DisplayLinkURI.hack
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class HTMLPurifier_Injector_DisplayLinkURI extends HTMLPurifier\HTMLPurifier_Inj
*/
public dict<string, vec<string>> $needed = dict['a' => vec[]];


/**
* @param HTMLPurifier_Token $token
*/
Expand Down
1 change: 0 additions & 1 deletion src/Lexer/DOMLex.hack
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use namespace HTMLPurifier;
use namespace HH\Lib\{C, Regex, Str};
use namespace HTMLPurifier\Token;


/**
* Parser that uses Hacklang DOMNode.
*/
Expand Down
1 change: 0 additions & 1 deletion src/Node/Text.hack
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ class HTMLPurifier_Node_Text extends HTMLPurifier\HTMLPurifier_Node {
return tuple(new Token\HTMLPurifier_Token_Text($this->data, $this->line, $this->col), null);
}


}
1 change: 0 additions & 1 deletion src/PropertyList.hack
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class HTMLPurifier_PropertyList {
//cache
protected keyset<arraykey> $cache = keyset[];


public function __construct(?HTMLPurifier_PropertyList $parent = null) {
$this->parent = $parent;
}
Expand Down
1 change: 0 additions & 1 deletion src/Strategy/MakeWellFormed.hack
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier\HTMLPurifier_Str
$this->token = $token;
}


// punt!
$reprocess = false;
continue;
Expand Down
1 change: 0 additions & 1 deletion src/Token/Empty.hack
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ class HTMLPurifier_Token_Empty extends HTMLPurifier_Token_Tag {
}
}


2 changes: 0 additions & 2 deletions src/TokenFactory.hack
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* Created by Nikita Ashok and Jake Polacek on 08/04/2020 */
namespace HTMLPurifier;


/**
* Factory for token generation.
*/
Expand Down Expand Up @@ -41,5 +40,4 @@ class HTMLPurifier_TokenFactory {
return new Token\HTMLPurifier_Token_Comment($data);
}


}
3 changes: 0 additions & 3 deletions tests/HTMLPurifierTest.hack
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ class HTMLPurifierTest extends HackTest {
echo "finished.\n\n";
}


public function testSanitizeHtmlWithIframeForVideoPolicySet(): void {
echo "\nrunning testSanitizeHtmlWithIframeForVideoPolicySet()...";
//porting over first config classes....
Expand All @@ -251,7 +250,6 @@ class HTMLPurifierTest extends HackTest {
);
$purifier = new HTMLPurifier\HTMLPurifier($config, $policy);


$dirty_html = '<iframe src="https://www.example.com/watch?v=M84hFmNhTQU" height="364" width="576"></iframe>';
$clean_html = $purifier->purify($dirty_html);
expect($clean_html)->toEqual(
Expand Down Expand Up @@ -537,7 +535,6 @@ class HTMLPurifierTest extends HackTest {
echo "finished.\n\n";
}


public function testAtagTargetAttribute(): void {
echo "\nrunning testAtagTargetAttribute()...";
$policy = new HTMLPurifier\HTMLPurifier_Policy(
Expand Down

0 comments on commit 00f187b

Please sign in to comment.