| 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } else if (context->isWorkerGlobalScope()) { | 816 } else if (context->isWorkerGlobalScope()) { |
| 817 if (WorkerOrWorkletScriptController* script = | 817 if (WorkerOrWorkletScriptController* script = |
| 818 toWorkerOrWorkletGlobalScope(context)->scriptController()) { | 818 toWorkerOrWorkletGlobalScope(context)->scriptController()) { |
| 819 if (script->getScriptState()->contextIsValid()) | 819 if (script->getScriptState()->contextIsValid()) |
| 820 return script->getScriptState()->context(); | 820 return script->getScriptState()->context(); |
| 821 } | 821 } |
| 822 } | 822 } |
| 823 return v8::Local<v8::Context>(); | 823 return v8::Local<v8::Context>(); |
| 824 } | 824 } |
| 825 | 825 |
| 826 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) { | 826 v8::Local<v8::Context> toV8Context(LocalFrame* frame, DOMWrapperWorld& world) { |
| 827 if (!frame) | 827 if (!frame) |
| 828 return v8::Local<v8::Context>(); | 828 return v8::Local<v8::Context>(); |
| 829 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); | 829 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); |
| 830 if (context.IsEmpty()) | 830 if (context.IsEmpty()) |
| 831 return v8::Local<v8::Context>(); | 831 return v8::Local<v8::Context>(); |
| 832 ScriptState* scriptState = ScriptState::from(context); | 832 ScriptState* scriptState = ScriptState::from(context); |
| 833 if (scriptState->contextIsValid()) { | 833 if (scriptState->contextIsValid()) { |
| 834 ASSERT(toFrameIfNotDetached(context) == frame); | 834 ASSERT(toFrameIfNotDetached(context) == frame); |
| 835 return scriptState->context(); | 835 return scriptState->context(); |
| 836 } | 836 } |
| 837 return v8::Local<v8::Context>(); | 837 return v8::Local<v8::Context>(); |
| 838 } | 838 } |
| 839 | 839 |
| 840 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, | 840 v8::Local<v8::Context> toV8ContextEvenIfDetached(LocalFrame* frame, |
| 841 DOMWrapperWorld& world) { | 841 DOMWrapperWorld& world) { |
| 842 ASSERT(frame); | 842 ASSERT(frame); |
| 843 return frame->windowProxy(world)->contextIfInitialized(); | 843 return frame->script().windowProxy(world)->contextIfInitialized(); |
| 844 } | 844 } |
| 845 | 845 |
| 846 void crashIfIsolateIsDead(v8::Isolate* isolate) { | 846 void crashIfIsolateIsDead(v8::Isolate* isolate) { |
| 847 if (isolate->IsDead()) { | 847 if (isolate->IsDead()) { |
| 848 // FIXME: We temporarily deal with V8 internal error situations | 848 // FIXME: We temporarily deal with V8 internal error situations |
| 849 // such as out-of-memory by crashing the renderer. | 849 // such as out-of-memory by crashing the renderer. |
| 850 CRASH(); | 850 CRASH(); |
| 851 } | 851 } |
| 852 } | 852 } |
| 853 | 853 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 1001 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
| 1002 parsed, tryCatch)) { | 1002 parsed, tryCatch)) { |
| 1003 if (tryCatch.HasCaught()) | 1003 if (tryCatch.HasCaught()) |
| 1004 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 1004 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 return parsed; | 1007 return parsed; |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 } // namespace blink | 1010 } // namespace blink |
| OLD | NEW |