| Differences between
and this patch
- a/Source/JavaScriptCore/ChangeLog +16 lines
Lines 1-3 a/Source/JavaScriptCore/ChangeLog_sec1
1
2018-03-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3
        HTML `pattern` attribute should set `u` flag for regular expressions
4
        https://bugs.webkit.org/show_bug.cgi?id=151598
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Add UnicodeMode for JSC::Yarr::RegularExpression.
9
10
        * yarr/RegularExpression.cpp:
11
        (JSC::Yarr::RegularExpression::Private::create):
12
        (JSC::Yarr::RegularExpression::Private::Private):
13
        (JSC::Yarr::RegularExpression::Private::compile):
14
        (JSC::Yarr::RegularExpression::RegularExpression):
15
        * yarr/RegularExpression.h:
16
1
2018-03-07  Dominik Infuehr  <dinfuehr@igalia.com>
17
2018-03-07  Dominik Infuehr  <dinfuehr@igalia.com>
2
18
3
        [ARM] offlineasm: fix indentation in armOpcodeReversedOperands
19
        [ARM] offlineasm: fix indentation in armOpcodeReversedOperands
- a/Source/WebCore/ChangeLog +14 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2018-03-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3
        HTML `pattern` attribute should set `u` flag for regular expressions
4
        https://bugs.webkit.org/show_bug.cgi?id=151598
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        This patch attaches "u" flag to the RegExp compiled for HTML "pattern" attribute[1].
9
10
        [1]: https://html.spec.whatwg.org/multipage/forms.html#the-pattern-attribute
11
12
        * html/BaseTextInputType.cpp:
13
        (WebCore::BaseTextInputType::patternMismatch const):
14
1
2018-03-06  Brian Burg  <bburg@apple.com>
15
2018-03-06  Brian Burg  <bburg@apple.com>
2
16
3
        [Cocoa] Stop copying ForwardingHeaders directory that no longer exists
17
        [Cocoa] Stop copying ForwardingHeaders directory that no longer exists
- a/Source/JavaScriptCore/yarr/RegularExpression.cpp -7 / +10 lines
Lines 37-45 namespace JSC { namespace Yarr { a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec1
37
37
38
class RegularExpression::Private : public RefCounted<RegularExpression::Private> {
38
class RegularExpression::Private : public RefCounted<RegularExpression::Private> {
39
public:
39
public:
40
    static Ref<Private> create(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
40
    static Ref<Private> create(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
41
    {
41
    {
42
        return adoptRef(*new Private(pattern, caseSensitivity, multilineMode));
42
        return adoptRef(*new Private(pattern, caseSensitivity, multilineMode, unicodeMode));
43
    }
43
    }
44
44
45
    int lastMatchLength { -1 };
45
    int lastMatchLength { -1 };
Lines 48-59 class RegularExpression::Private : public RefCounted<RegularExpression::Private> a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec2
48
    std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
48
    std::unique_ptr<JSC::Yarr::BytecodePattern> m_regExpByteCode;
49
49
50
private:
50
private:
51
    Private(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
51
    Private(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
52
        : m_regExpByteCode(compile(pattern, caseSensitivity, multilineMode))
52
        : m_regExpByteCode(compile(pattern, caseSensitivity, multilineMode, unicodeMode))
53
    {
53
    {
54
    }
54
    }
55
55
56
    std::unique_ptr<JSC::Yarr::BytecodePattern> compile(const String& patternString, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
56
    std::unique_ptr<JSC::Yarr::BytecodePattern> compile(const String& patternString, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
57
    {
57
    {
58
        RegExpFlags flags = NoFlags;
58
        RegExpFlags flags = NoFlags;
59
59
Lines 63-68 class RegularExpression::Private : public RefCounted<RegularExpression::Private> a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec3
63
        if (multilineMode == MultilineEnabled)
63
        if (multilineMode == MultilineEnabled)
64
            flags = static_cast<RegExpFlags>(flags | FlagMultiline);
64
            flags = static_cast<RegExpFlags>(flags | FlagMultiline);
65
65
66
        if (unicodeMode == UnicodeAwareMode)
67
            flags = static_cast<RegExpFlags>(flags | FlagUnicode);
68
66
        JSC::Yarr::YarrPattern pattern(patternString, flags, m_constructionErrorCode);
69
        JSC::Yarr::YarrPattern pattern(patternString, flags, m_constructionErrorCode);
67
        if (JSC::Yarr::hasError(m_constructionErrorCode)) {
70
        if (JSC::Yarr::hasError(m_constructionErrorCode)) {
68
            LOG_ERROR("RegularExpression: YARR compile failed with '%s'", JSC::Yarr::errorMessage(m_constructionErrorCode));
71
            LOG_ERROR("RegularExpression: YARR compile failed with '%s'", JSC::Yarr::errorMessage(m_constructionErrorCode));
Lines 78-85 class RegularExpression::Private : public RefCounted<RegularExpression::Private> a/Source/JavaScriptCore/yarr/RegularExpression.cpp_sec4
78
    JSC::Yarr::ErrorCode m_constructionErrorCode { Yarr::ErrorCode::NoError };
81
    JSC::Yarr::ErrorCode m_constructionErrorCode { Yarr::ErrorCode::NoError };
79
};
82
};
80
83
81
RegularExpression::RegularExpression(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode)
84
RegularExpression::RegularExpression(const String& pattern, TextCaseSensitivity caseSensitivity, MultilineMode multilineMode, UnicodeMode unicodeMode)
82
    : d(Private::create(pattern, caseSensitivity, multilineMode))
85
    : d(Private::create(pattern, caseSensitivity, multilineMode, unicodeMode))
83
{
86
{
84
}
87
}
85
88
- a/Source/JavaScriptCore/yarr/RegularExpression.h -1 / +2 lines
Lines 31-41 namespace JSC { namespace Yarr { a/Source/JavaScriptCore/yarr/RegularExpression.h_sec1
31
31
32
enum MultilineMode { MultilineDisabled, MultilineEnabled };
32
enum MultilineMode { MultilineDisabled, MultilineEnabled };
33
enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
33
enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
34
enum UnicodeMode { UnicodeUnawareMode, UnicodeAwareMode };
34
35
35
class JS_EXPORT_PRIVATE RegularExpression {
36
class JS_EXPORT_PRIVATE RegularExpression {
36
    WTF_MAKE_FAST_ALLOCATED;
37
    WTF_MAKE_FAST_ALLOCATED;
37
public:
38
public:
38
    explicit RegularExpression(const String&, TextCaseSensitivity = TextCaseSensitive, MultilineMode = MultilineDisabled);
39
    explicit RegularExpression(const String&, TextCaseSensitivity = TextCaseSensitive, MultilineMode = MultilineDisabled, UnicodeMode = UnicodeUnawareMode);
39
    ~RegularExpression();
40
    ~RegularExpression();
40
41
41
    RegularExpression(const RegularExpression&);
42
    RegularExpression(const RegularExpression&);
- a/Source/WebCore/html/BaseTextInputType.cpp -2 / +4 lines
Lines 39-51 bool BaseTextInputType::isTextType() const a/Source/WebCore/html/BaseTextInputType.cpp_sec1
39
39
40
bool BaseTextInputType::patternMismatch(const String& value) const
40
bool BaseTextInputType::patternMismatch(const String& value) const
41
{
41
{
42
    // FIXME: We should execute RegExp parser first to check validity instead of creating an actual RegularExpression.
43
    // https://bugs.webkit.org/show_bug.cgi?id=183361
42
    const AtomicString& rawPattern = element().attributeWithoutSynchronization(patternAttr);
44
    const AtomicString& rawPattern = element().attributeWithoutSynchronization(patternAttr);
43
    if (rawPattern.isNull() || value.isEmpty() || !JSC::Yarr::RegularExpression(rawPattern).isValid())
45
    if (rawPattern.isNull() || value.isEmpty() || !JSC::Yarr::RegularExpression(rawPattern, JSC::Yarr::TextCaseSensitive, JSC::Yarr::MultilineDisabled, JSC::Yarr::UnicodeAwareMode).isValid())
44
        return false;
46
        return false;
45
    String pattern = "^(?:" + rawPattern + ")$";
47
    String pattern = "^(?:" + rawPattern + ")$";
46
    int matchLength = 0;
48
    int matchLength = 0;
47
    int valueLength = value.length();
49
    int valueLength = value.length();
48
    int matchOffset = JSC::Yarr::RegularExpression(pattern).match(value, 0, &matchLength);
50
    int matchOffset = JSC::Yarr::RegularExpression(pattern, JSC::Yarr::TextCaseSensitive, JSC::Yarr::MultilineDisabled, JSC::Yarr::UnicodeAwareMode).match(value, 0, &matchLength);
49
    return matchOffset || matchLength != valueLength;
51
    return matchOffset || matchLength != valueLength;
50
}
52
}
51
53
- a/LayoutTests/ChangeLog +10 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2018-03-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3
        HTML `pattern` attribute should set `u` flag for regular expressions
4
        https://bugs.webkit.org/show_bug.cgi?id=151598
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * fast/forms/ValidityState-patternMismatch-expected.txt:
9
        * fast/forms/ValidityState-patternMismatch.html:
10
1
2018-03-07  Ms2ger  <Ms2ger@igalia.com>
11
2018-03-07  Ms2ger  <Ms2ger@igalia.com>
2
12
3
        [WPE] Test gardening
13
        [WPE] Test gardening
- a/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt +5 lines
Lines 28-33 PASS patternMismatchFor("match-17") is false a/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt_sec1
28
PASS patternMismatchFor("match-18") is false
28
PASS patternMismatchFor("match-18") is false
29
PASS patternMismatchFor("match-19") is false
29
PASS patternMismatchFor("match-19") is false
30
PASS patternMismatchFor("match-20") is false
30
PASS patternMismatchFor("match-20") is false
31
PASS patternMismatchFor("match-21") is false
32
PASS patternMismatchFor("match-22") is false
31
PASS patternMismatchFor("wrong-gray-or-grey") is true
33
PASS patternMismatchFor("wrong-gray-or-grey") is true
32
PASS patternMismatchFor("gray") is false
34
PASS patternMismatchFor("gray") is false
33
PASS patternMismatchFor("grey") is false
35
PASS patternMismatchFor("grey") is false
Lines 53-58 PASS patternMismatchFor("mismatch-18") is true a/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt_sec2
53
PASS patternMismatchFor("mismatch-19") is true
55
PASS patternMismatchFor("mismatch-19") is true
54
PASS patternMismatchFor("mismatch-20") is true
56
PASS patternMismatchFor("mismatch-20") is true
55
PASS patternMismatchFor("mismatch-21") is true
57
PASS patternMismatchFor("mismatch-21") is true
58
PASS patternMismatchFor("mismatch-22") is true
56
PASS patternMismatchFor("empty-pattern-match") is false
59
PASS patternMismatchFor("empty-pattern-match") is false
57
PASS patternMismatchFor("empty-pattern-mismatch") is true
60
PASS patternMismatchFor("empty-pattern-mismatch") is true
58
PASS patternMismatchFor("invalid-01") is false
61
PASS patternMismatchFor("invalid-01") is false
Lines 61-66 PASS patternMismatchFor("invalid-03") is false a/LayoutTests/fast/forms/ValidityState-patternMismatch-expected.txt_sec3
61
PASS patternMismatchFor("invalid-04") is false
64
PASS patternMismatchFor("invalid-04") is false
62
PASS patternMismatchFor("invalid-05") is false
65
PASS patternMismatchFor("invalid-05") is false
63
PASS patternMismatchFor("invalid-06") is false
66
PASS patternMismatchFor("invalid-06") is false
67
PASS patternMismatchFor("invalid-07") is false
68
PASS patternMismatchFor("invalid-08") is false
64
PASS patternMismatchFor("disabled") is false
69
PASS patternMismatchFor("disabled") is false
65
PASS successfullyParsed is true
70
PASS successfullyParsed is true
66
71
- a/LayoutTests/fast/forms/ValidityState-patternMismatch.html -1 / +11 lines
Lines 32-37 a/LayoutTests/fast/forms/ValidityState-patternMismatch.html_sec1
32
<input id="match-18" type="text" pattern="[0-9]|10|11|12" value="10" />
32
<input id="match-18" type="text" pattern="[0-9]|10|11|12" value="10" />
33
<input id="match-19" type="text" pattern="10|11|12|[0-9]" value="12" />
33
<input id="match-19" type="text" pattern="10|11|12|[0-9]" value="12" />
34
<input id="match-20" type="text" pattern="f(o|e)\1" value="foo" />
34
<input id="match-20" type="text" pattern="f(o|e)\1" value="foo" />
35
<input id="match-21" type="text" pattern="a.b" value="a&#x1D306;b" />
36
<input id="match-22" type="text" pattern="a..b" value="a&#x1D306;b" />
35
<input id="empty-pattern-match" type="text" pattern="" value="" />
37
<input id="empty-pattern-match" type="text" pattern="" value="" />
36
<input id="wrong-gray-or-grey" type="text" pattern="gr[ae]y" value="Wrong!"
38
<input id="wrong-gray-or-grey" type="text" pattern="gr[ae]y" value="Wrong!"
37
/><input id="gray" type="text" pattern="gr[ae]y" value="gray"
39
/><input id="gray" type="text" pattern="gr[ae]y" value="gray"
Lines 57-63 a/LayoutTests/fast/forms/ValidityState-patternMismatch.html_sec2
57
/><input id="mismatch-18" type="text" pattern="foo\\" value="food"
59
/><input id="mismatch-18" type="text" pattern="foo\\" value="food"
58
/><input id="mismatch-19" type="text" pattern="^" value="wrong"
60
/><input id="mismatch-19" type="text" pattern="^" value="wrong"
59
/><input id="mismatch-20" type="text" pattern="$" value="wrong"
61
/><input id="mismatch-20" type="text" pattern="$" value="wrong"
60
/><input id="mismatch-21" type="text" pattern="f(o|e)\1" value="foe"/>
62
/><input id="mismatch-21" type="text" pattern="f(o|e)\1" value="foe"
63
/><input id="mismatch-22" type="text" pattern="a...b" value="a&#x1D306;b" />
61
64
62
<input id="invalid-01" type="text" pattern=")foo(" value="foo"/>
65
<input id="invalid-01" type="text" pattern=")foo(" value="foo"/>
63
<input id="invalid-02" type="text" pattern=")foo(" value="foobar"/>
66
<input id="invalid-02" type="text" pattern=")foo(" value="foobar"/>
Lines 65-70 a/LayoutTests/fast/forms/ValidityState-patternMismatch.html_sec3
65
<input id="invalid-04" type="text" pattern="foo\" value="foo\"/>
68
<input id="invalid-04" type="text" pattern="foo\" value="foo\"/>
66
<input id="invalid-05" type="text" pattern="[0-9" value="1"/>
69
<input id="invalid-05" type="text" pattern="[0-9" value="1"/>
67
<input id="invalid-06" type="text" pattern="[0-9" value="a"/>
70
<input id="invalid-06" type="text" pattern="[0-9" value="a"/>
71
<input id="invalid-07" type="text" pattern="foo\'bar" value="foo'bar"/>
72
<input id="invalid-08" type="text" pattern="foo\'bar" value="foo"/>
68
73
69
<input id="empty-pattern-mismatch" type="text" pattern="" value="Lorem Ipsum"
74
<input id="empty-pattern-mismatch" type="text" pattern="" value="Lorem Ipsum"
70
/><input id="disabled" pattern="[0-9][A-Z]{3}" value="00AA" disabled /></div>
75
/><input id="disabled" pattern="[0-9][A-Z]{3}" value="00AA" disabled /></div>
Lines 101-106 a/LayoutTests/fast/forms/ValidityState-patternMismatch.html_sec4
101
shouldBeFalse('patternMismatchFor("match-18")');
106
shouldBeFalse('patternMismatchFor("match-18")');
102
shouldBeFalse('patternMismatchFor("match-19")');
107
shouldBeFalse('patternMismatchFor("match-19")');
103
shouldBeFalse('patternMismatchFor("match-20")');
108
shouldBeFalse('patternMismatchFor("match-20")');
109
shouldBeFalse('patternMismatchFor("match-21")');
110
shouldBeFalse('patternMismatchFor("match-22")');
104
111
105
shouldBeTrue('patternMismatchFor("wrong-gray-or-grey")');
112
shouldBeTrue('patternMismatchFor("wrong-gray-or-grey")');
106
shouldBeFalse('patternMismatchFor("gray")');
113
shouldBeFalse('patternMismatchFor("gray")');
Lines 128-133 a/LayoutTests/fast/forms/ValidityState-patternMismatch.html_sec5
128
shouldBeTrue('patternMismatchFor("mismatch-19")');
135
shouldBeTrue('patternMismatchFor("mismatch-19")');
129
shouldBeTrue('patternMismatchFor("mismatch-20")');
136
shouldBeTrue('patternMismatchFor("mismatch-20")');
130
shouldBeTrue('patternMismatchFor("mismatch-21")');
137
shouldBeTrue('patternMismatchFor("mismatch-21")');
138
shouldBeTrue('patternMismatchFor("mismatch-22")');
131
139
132
shouldBeFalse('patternMismatchFor("empty-pattern-match")');
140
shouldBeFalse('patternMismatchFor("empty-pattern-match")');
133
shouldBeTrue('patternMismatchFor("empty-pattern-mismatch")');
141
shouldBeTrue('patternMismatchFor("empty-pattern-mismatch")');
Lines 138-143 a/LayoutTests/fast/forms/ValidityState-patternMismatch.html_sec6
138
shouldBeFalse('patternMismatchFor("invalid-04")');
146
shouldBeFalse('patternMismatchFor("invalid-04")');
139
shouldBeFalse('patternMismatchFor("invalid-05")');
147
shouldBeFalse('patternMismatchFor("invalid-05")');
140
shouldBeFalse('patternMismatchFor("invalid-06")');
148
shouldBeFalse('patternMismatchFor("invalid-06")');
149
shouldBeFalse('patternMismatchFor("invalid-07")');
150
shouldBeFalse('patternMismatchFor("invalid-08")');
141
151
142
shouldBeFalse('patternMismatchFor("disabled")');
152
shouldBeFalse('patternMismatchFor("disabled")');
143
153

Return to Bug 151598