diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2018-04-17 16:23:51 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-04-27 07:30:24 +0000 |
commit | ff0a83a6c3e64772276cb71cba0392d1e89b037f (patch) | |
tree | f2170055d12cef72dd620be1a4418aed6e36d96f /src/core/user_script.cpp | |
parent | 216240a31baae6e54e38de8157332f272ddf57a7 (diff) |
Fix handling of bad @match directives
User scripts with parse errors in their @match patterns were included
on all pages. Don't allow to fallback to "@include *" in this case.
Task-number: QTBUG-67726
Change-Id: I8172184e79fe3e515f391bc6cc8274a624e67a19
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/user_script.cpp')
-rw-r--r-- | src/core/user_script.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index 9b9d66d55..bdd6524ca 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "common/user_script_data.h" -#include "extensions/common/url_pattern.h" #include "user_script.h" #include "type_conversion.h" @@ -66,11 +65,6 @@ bool GetDeclarationValue(const base::StringPiece& line, namespace QtWebEngineCore { -int UserScript::validUserScriptSchemes() -{ - return URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | URLPattern::SCHEME_FILE; -} - ASSERT_ENUMS_MATCH(UserScript::AfterLoad, UserScriptData::AfterLoad) ASSERT_ENUMS_MATCH(UserScript::DocumentLoadFinished, UserScriptData::DocumentLoadFinished) ASSERT_ENUMS_MATCH(UserScript::DocumentElementCreation, UserScriptData::DocumentElementCreation) @@ -222,8 +216,6 @@ void UserScript::parseMetadataHeader() // support @noframes rule, we have to change the current default behavior. // static const base::StringPiece kNoFramesDeclaration("// @noframes"); - static URLPattern urlPatternParser(validUserScriptSchemes()); - while (line_start < script_text.length()) { line_end = script_text.find('\n', line_start); @@ -260,8 +252,7 @@ void UserScript::parseMetadataHeader() } scriptData->excludeGlobs.push_back(value); } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { - if (URLPattern::PARSE_SUCCESS == urlPatternParser.Parse(value)) - scriptData->urlPatterns.push_back(value); + scriptData->urlPatterns.push_back(value); } else if (GetDeclarationValue(line, kRunAtDeclaration, &value)) { if (value == kRunAtDocumentStartValue) scriptData->injectionPoint = DocumentElementCreation; |