[WebIDL] Remove custom bindings that require non-caching JS strings
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jul 2017 03:52:23 +0000 (03:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jul 2017 03:52:23 +0000 (03:52 +0000)
commitc75d0b97d416fb373cf90ba9492243606d39760d
tree5fc8c4250d76c3c49191929be8bdffc844a2a6e9
parent8b539635bed2eb35261e09e0ee49e05880818bba
[WebIDL] Remove custom bindings that require non-caching JS strings
https://bugs.webkit.org/show_bug.cgi?id=174552

Patch by Sam Weinig <sam@webkit.org> on 2017-07-17
Reviewed by Darin Adler.

Source/WebCore:

Adds two new types, UncachedString and OwnedString (both of which
are simple structs that wrap a String) to communicate to the bindings
layer which function to use when converting to a JS string.

* bindings/IDLTypes.h:
(WebCore::IDLString::isNullValue):
Add overloads of isNullValue for UncachedString and OwnedString.

* bindings/js/JSDOMConvertStrings.h:
(WebCore::JSConverter<IDLDOMString>::convert):
(WebCore::JSConverter<IDLByteString>::convert):
(WebCore::JSConverter<IDLUSVString>::convert):
Add overloads of convert for UncachedString that uses JSC::jsString
and for OwnedString that uses JSC::jsOwnedString.

* bindings/js/JSHTMLCanvasElementCustom.cpp:
(WebCore::JSHTMLCanvasElement::toDataURL): Deleted.
Remove custom binding for toDataURL.

* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::retrieveResponse):
(WebCore::JSXMLHttpRequest::responseText): Deleted.
Remove custom binding for responseText. Replace the caller of the
binding function with a simple conversion that will do the same thing.

* bindings/js/StringAdaptors.h: Added.
Add UncachedString and OwnedString adaptors.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toDataURL):
Move quality conversion here, matching toBlob and the spec. Return a UncachedString
to instruct the bindings to use JSC::jsString and not JSC::jsStringWithCache.

(WebCore::HTMLCanvasElement::toBlob):
Use asNumber() rather than toNumber(), since we just checked that it is a number.

* html/HTMLCanvasElement.h:
Update header to account for returning an UncachedString.

* html/HTMLCanvasElement.idl:
Remove [Custom] and make the signature of toDataURL match the spec (and what we have been doing).

* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::requestContent):
Update to account for UncachedString.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseText):
* xml/XMLHttpRequest.h:
Update responseText to return OwnedString. OwnedString instruct the bindings to
use JSC::jsOwnedString and not JSC::jsStringWithCache.

* xml/XMLHttpRequest.idl:
Remove [CustomGetter].

Source/WebKitLegacy/mac:

* DOM/DOMHTMLCanvasElement.mm:
(-[DOMHTMLCanvasElement toDataURL:]):
Update to account for implementation now returning an UncachedString.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219599 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/IDLTypes.h
Source/WebCore/bindings/js/JSDOMConvertStrings.h
Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
Source/WebCore/bindings/js/StringAdaptors.h [new file with mode: 0644]
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLCanvasElement.idl
Source/WebCore/inspector/InspectorCanvasAgent.cpp
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebCore/xml/XMLHttpRequest.idl
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOMHTMLCanvasElement.mm