FontFaceSet binding does not handle null correctly
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Apr 2016 04:26:27 +0000 (04:26 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Apr 2016 04:26:27 +0000 (04:26 +0000)
commitfbf1947bb4dd0a447b7a16cb4868d096dafb4561
tree57ffbb581204246028b6d5fb56445da972b6664a
parent808edbad1a2d210ef42577d201d56c33f75d70df
FontFaceSet binding does not handle null correctly
https://bugs.webkit.org/show_bug.cgi?id=156141

Reviewed by Youenn Fablet.

Source/WebCore:

* css/FontFaceSet.cpp:
(WebCore::FontFaceSet::FontFaceSet): Pass a reference to add rather than a pointer.
(WebCore::FontFaceSet::has): Take a reference rather than a pointer.
(WebCore::FontFaceSet::add): Ditto.
(WebCore::FontFaceSet::remove): Ditto.
(WebCore::FontFaceSet::load): Initialize ec since we check it. Caller is not required
to do this, nor is the matchingFaces function. Rearranged function to avoid needless
creation/destruction of PendingPromise for the immediate failure case. Removed some
unneeded type casts and local variables.
(WebCore::FontFaceSet::status): Use ASCIILiteral instead of ConstructFromLiteral.
No reason to use the more aggressive optimization.
(WebCore::FontFaceSet::faceFinished): Factored out a common hasReachedTerminalState
check to streamline the logic a bit.
(WebCore::FontFaceSet::load): Moved overload without a string in here; not critical
to inline it.
(WebCore::FontFaceSet::check): Ditto.

* css/FontFaceSet.h: Removed many unneeded includes and forward declarations.
Changed functions to take FontFace& instead of RefPtr<FontFace>. Removed unneeded
WebCore namespace prefixes. Use final instead of override for virtual functions.

* css/FontFaceSet.idl: Removed UsePointersEvenForNonNullableObjectArguments, which
was preserving incorrect behavior for null as demonstrated by the test cases.

LayoutTests:

* fast/text/font-face-set-javascript-expected.txt: Added expected results for new tests.
* fast/text/font-face-set-javascript.html: Added tests for handling of null, also added tests for
the has function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/font-face-set-javascript-expected.txt
LayoutTests/fast/text/font-face-set-javascript.html
Source/WebCore/ChangeLog
Source/WebCore/css/FontFaceSet.cpp
Source/WebCore/css/FontFaceSet.h
Source/WebCore/css/FontFaceSet.idl