| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 } else if (context->isWorkerGlobalScope()) { | 804 } else if (context->isWorkerGlobalScope()) { |
| 805 if (WorkerOrWorkletScriptController* script = | 805 if (WorkerOrWorkletScriptController* script = |
| 806 toWorkerOrWorkletGlobalScope(context)->scriptController()) { | 806 toWorkerOrWorkletGlobalScope(context)->scriptController()) { |
| 807 if (script->getScriptState()->contextIsValid()) | 807 if (script->getScriptState()->contextIsValid()) |
| 808 return script->getScriptState()->context(); | 808 return script->getScriptState()->context(); |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 return v8::Local<v8::Context>(); | 811 return v8::Local<v8::Context>(); |
| 812 } | 812 } |
| 813 | 813 |
| 814 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) { | 814 v8::Local<v8::Context> toV8Context(LocalFrame* frame, DOMWrapperWorld& world) { |
| 815 if (!frame) | 815 if (!frame) |
| 816 return v8::Local<v8::Context>(); | 816 return v8::Local<v8::Context>(); |
| 817 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); | 817 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); |
| 818 if (context.IsEmpty()) | 818 if (context.IsEmpty()) |
| 819 return v8::Local<v8::Context>(); | 819 return v8::Local<v8::Context>(); |
| 820 ScriptState* scriptState = ScriptState::from(context); | 820 ScriptState* scriptState = ScriptState::from(context); |
| 821 if (scriptState->contextIsValid()) { | 821 if (scriptState->contextIsValid()) { |
| 822 ASSERT(toFrameIfNotDetached(context) == frame); | 822 ASSERT(toFrameIfNotDetached(context) == frame); |
| 823 return scriptState->context(); | 823 return scriptState->context(); |
| 824 } | 824 } |
| 825 return v8::Local<v8::Context>(); | 825 return v8::Local<v8::Context>(); |
| 826 } | 826 } |
| 827 | 827 |
| 828 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, | 828 v8::Local<v8::Context> toV8ContextEvenIfDetached(LocalFrame* frame, |
| 829 DOMWrapperWorld& world) { | 829 DOMWrapperWorld& world) { |
| 830 ASSERT(frame); | 830 ASSERT(frame); |
| 831 return frame->windowProxy(world)->contextIfInitialized(); | 831 return frame->script().windowProxy(world)->contextIfInitialized(); |
| 832 } | 832 } |
| 833 | 833 |
| 834 bool isValidEnum(const String& value, | 834 bool isValidEnum(const String& value, |
| 835 const char** validValues, | 835 const char** validValues, |
| 836 size_t length, | 836 size_t length, |
| 837 const String& enumName, | 837 const String& enumName, |
| 838 ExceptionState& exceptionState) { | 838 ExceptionState& exceptionState) { |
| 839 for (size_t i = 0; i < length; ++i) { | 839 for (size_t i = 0; i < length; ++i) { |
| 840 // Avoid the strlen inside String::operator== (because of the StringView). | 840 // Avoid the strlen inside String::operator== (because of the StringView). |
| 841 if (WTF::equal(value.impl(), validValues[i])) | 841 if (WTF::equal(value.impl(), validValues[i])) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 981 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
| 982 parsed, tryCatch)) { | 982 parsed, tryCatch)) { |
| 983 if (tryCatch.HasCaught()) | 983 if (tryCatch.HasCaught()) |
| 984 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 984 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
| 985 } | 985 } |
| 986 | 986 |
| 987 return parsed; | 987 return parsed; |
| 988 } | 988 } |
| 989 | 989 |
| 990 } // namespace blink | 990 } // namespace blink |
| OLD | NEW |