From 6882a04fb36642862b11efe514251d32070c3d65 Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Thu, 25 Aug 2016 19:20:41 +0300 Subject: Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443) Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev --- Source/JavaScriptCore/API/ObjcRuntimeExtras.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Source/JavaScriptCore/API/ObjcRuntimeExtras.h') diff --git a/Source/JavaScriptCore/API/ObjcRuntimeExtras.h b/Source/JavaScriptCore/API/ObjcRuntimeExtras.h index 48c112093..128df5c90 100644 --- a/Source/JavaScriptCore/API/ObjcRuntimeExtras.h +++ b/Source/JavaScriptCore/API/ObjcRuntimeExtras.h @@ -23,6 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#import #import #import #import @@ -163,7 +164,7 @@ typename DelegateType::ResultType parseObjCType(const char*& position) case 'l': return DelegateType::template typeInteger(); case 'q': - return DelegateType::template typeDouble(); + return DelegateType::template typeDouble(); case 'C': return DelegateType::template typeInteger(); case 'I': @@ -192,9 +193,19 @@ typename DelegateType::ResultType parseObjCType(const char*& position) } if (*position == '"') { - const char* begin = ++position; - position = index(position, '"'); - return DelegateType::typeOfClass(begin, position++); + const char* begin = position + 1; + const char* protocolPosition = strchr(begin, '<'); + const char* endOfType = strchr(begin, '"'); + position = endOfType + 1; + + // There's no protocol involved in this type, so just handle the class name. + if (!protocolPosition || protocolPosition > endOfType) + return DelegateType::typeOfClass(begin, endOfType); + // We skipped the class name and went straight to the protocol, so this is an id type. + if (begin == protocolPosition) + return DelegateType::typeId(); + // We have a class name with a protocol. For now, ignore the protocol. + return DelegateType::typeOfClass(begin, protocolPosition); } return DelegateType::typeId(); -- cgit v1.2.1