OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Collabora Ltd. | 3 * Copyright (C) 2008 Collabora Ltd. |
4 * Copyright (C) 2011 Peter Varga (pvarga@webkit.org), University of Szeged | 4 * Copyright (C) 2011 Peter Varga (pvarga@webkit.org), University of Szeged |
5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (caseSensitivity == TextCaseInsensitive) | 47 if (caseSensitivity == TextCaseInsensitive) |
48 flags |= v8::RegExp::kIgnoreCase; | 48 flags |= v8::RegExp::kIgnoreCase; |
49 if (multilineMode == MultilineEnabled) | 49 if (multilineMode == MultilineEnabled) |
50 flags |= v8::RegExp::kMultiline; | 50 flags |= v8::RegExp::kMultiline; |
51 if (charMode == UTF16) | 51 if (charMode == UTF16) |
52 flags |= v8::RegExp::kUnicode; | 52 flags |= v8::RegExp::kUnicode; |
53 | 53 |
54 v8::Local<v8::RegExp> regex; | 54 v8::Local<v8::RegExp> regex; |
55 if (v8::RegExp::New(context, v8String(isolate, pattern), static_cast<v8::Reg
Exp::Flags>(flags)).ToLocal(®ex)) | 55 if (v8::RegExp::New(context, v8String(isolate, pattern), static_cast<v8::Reg
Exp::Flags>(flags)).ToLocal(®ex)) |
56 m_regex.set(isolate, regex); | 56 m_regex.set(isolate, regex); |
| 57 if (tryCatch.HasCaught() && !tryCatch.Message().IsEmpty()) |
| 58 m_exceptionMessage = toCoreStringWithUndefinedOrNullCheck(tryCatch.Messa
ge()->Get()); |
57 } | 59 } |
58 | 60 |
59 int ScriptRegexp::match(const String& string, int startFrom, int* matchLength) c
onst | 61 int ScriptRegexp::match(const String& string, int startFrom, int* matchLength) c
onst |
60 { | 62 { |
61 if (matchLength) | 63 if (matchLength) |
62 *matchLength = 0; | 64 *matchLength = 0; |
63 | 65 |
64 if (m_regex.isEmpty() || string.isNull()) | 66 if (m_regex.isEmpty() || string.isNull()) |
65 return -1; | 67 return -1; |
66 | 68 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 v8::Local<v8::Value> match; | 106 v8::Local<v8::Value> match; |
105 if (!result->Get(context, 0).ToLocal(&match)) | 107 if (!result->Get(context, 0).ToLocal(&match)) |
106 return -1; | 108 return -1; |
107 *matchLength = match.As<v8::String>()->Length(); | 109 *matchLength = match.As<v8::String>()->Length(); |
108 } | 110 } |
109 | 111 |
110 return matchOffset.As<v8::Int32>()->Value() + startFrom; | 112 return matchOffset.As<v8::Int32>()->Value() + startFrom; |
111 } | 113 } |
112 | 114 |
113 } // namespace blink | 115 } // namespace blink |
OLD | NEW |