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 16 matching lines...) Expand all Loading... |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "bindings/core/v8/ScriptRegexp.h" | 30 #include "bindings/core/v8/ScriptRegexp.h" |
31 | 31 |
32 #include "bindings/core/v8/V8Binding.h" | 32 #include "bindings/core/v8/V8Binding.h" |
33 #include "bindings/core/v8/V8PerIsolateData.h" | 33 #include "bindings/core/v8/V8PerIsolateData.h" |
34 #include "bindings/core/v8/V8ScriptRunner.h" | 34 #include "bindings/core/v8/V8ScriptRunner.h" |
35 #include "platform/ScriptForbiddenScope.h" | 35 #include "platform/ScriptForbiddenScope.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace blink { |
38 | 38 |
39 ScriptRegexp::ScriptRegexp(const String& pattern, TextCaseSensitivity caseSensit
ivity, MultilineMode multilineMode) | 39 ScriptRegexp::ScriptRegexp(const String& pattern, TextCaseSensitivity caseSensit
ivity, MultilineMode multilineMode) |
40 { | 40 { |
41 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 41 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
42 v8::HandleScope handleScope(isolate); | 42 v8::HandleScope handleScope(isolate); |
43 v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureScrip
tRegexpContext()); | 43 v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureScrip
tRegexpContext()); |
44 v8::TryCatch tryCatch; | 44 v8::TryCatch tryCatch; |
45 | 45 |
46 unsigned flags = v8::RegExp::kNone; | 46 unsigned flags = v8::RegExp::kNone; |
47 if (caseSensitivity == TextCaseInsensitive) | 47 if (caseSensitivity == TextCaseInsensitive) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 v8::Local<v8::Array> result = returnValue.As<v8::Array>(); | 97 v8::Local<v8::Array> result = returnValue.As<v8::Array>(); |
98 int matchOffset = result->Get(v8AtomicString(isolate, "index"))->ToInt32()->
Value(); | 98 int matchOffset = result->Get(v8AtomicString(isolate, "index"))->ToInt32()->
Value(); |
99 if (matchLength) { | 99 if (matchLength) { |
100 v8::Local<v8::String> match = result->Get(0).As<v8::String>(); | 100 v8::Local<v8::String> match = result->Get(0).As<v8::String>(); |
101 *matchLength = match->Length(); | 101 *matchLength = match->Length(); |
102 } | 102 } |
103 | 103 |
104 return matchOffset + startFrom; | 104 return matchOffset + startFrom; |
105 } | 105 } |
106 | 106 |
107 } // namespace WebCore | 107 } // namespace blink |
OLD | NEW |