Commit 896a32d9 authored by Naina Raisinghani's avatar Naina Raisinghani Committed by Commit Bot

Change styleSheet_contents_fuzzer to fuzz in HTMLQuirksMode too

This should increase coverage by allowing the fuzz to produce test
cases in quirks mode too. HTMLQuirksMode has it's own issues in our
code base and getting fuzzer to run these tests would be great.

Change-Id: I0ea188d480d7bc605e0ddf62b665ba88ffde9b45
Reviewed-on: https://chromium-review.googlesource.com/701855Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: nainar <nainar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506952}
parent 44d4ba6d
...@@ -10,8 +10,13 @@ ...@@ -10,8 +10,13 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static blink::BlinkFuzzerTestSupport test_support = static blink::BlinkFuzzerTestSupport test_support =
blink::BlinkFuzzerTestSupport(); blink::BlinkFuzzerTestSupport();
blink::CSSParserContext* context =
blink::CSSParserContext::Create(blink::kHTMLStandardMode); const std::string data_string(reinterpret_cast<const char*>(data), size);
const size_t data_hash = std::hash<std::string>()(data_string);
const int is_strict_mode = (data_hash & std::numeric_limits<int>::max()) % 2;
blink::CSSParserContext* context = blink::CSSParserContext::Create(
is_strict_mode ? blink::kHTMLStandardMode : blink::kHTMLQuirksMode);
blink::StyleSheetContents* styleSheet = blink::StyleSheetContents* styleSheet =
blink::StyleSheetContents::Create(context); blink::StyleSheetContents::Create(context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment