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 821 matching lines...) Loading... |
832 } else if (context->isWorkerGlobalScope()) { | 832 } else if (context->isWorkerGlobalScope()) { |
833 if (WorkerOrWorkletScriptController* script = | 833 if (WorkerOrWorkletScriptController* script = |
834 toWorkerOrWorkletGlobalScope(context)->scriptController()) { | 834 toWorkerOrWorkletGlobalScope(context)->scriptController()) { |
835 if (script->getScriptState()->contextIsValid()) | 835 if (script->getScriptState()->contextIsValid()) |
836 return script->getScriptState()->context(); | 836 return script->getScriptState()->context(); |
837 } | 837 } |
838 } | 838 } |
839 return v8::Local<v8::Context>(); | 839 return v8::Local<v8::Context>(); |
840 } | 840 } |
841 | 841 |
842 v8::Local<v8::Context> toV8Context(Frame* frame, DOMWrapperWorld& world) { | 842 v8::Local<v8::Context> toV8Context(LocalFrame* frame, DOMWrapperWorld& world) { |
843 if (!frame) | 843 if (!frame) |
844 return v8::Local<v8::Context>(); | 844 return v8::Local<v8::Context>(); |
845 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); | 845 v8::Local<v8::Context> context = toV8ContextEvenIfDetached(frame, world); |
846 if (context.IsEmpty()) | 846 if (context.IsEmpty()) |
847 return v8::Local<v8::Context>(); | 847 return v8::Local<v8::Context>(); |
848 ScriptState* scriptState = ScriptState::from(context); | 848 ScriptState* scriptState = ScriptState::from(context); |
849 if (scriptState->contextIsValid()) { | 849 if (scriptState->contextIsValid()) { |
850 ASSERT(toFrameIfNotDetached(context) == frame); | 850 ASSERT(toFrameIfNotDetached(context) == frame); |
851 return scriptState->context(); | 851 return scriptState->context(); |
852 } | 852 } |
853 return v8::Local<v8::Context>(); | 853 return v8::Local<v8::Context>(); |
854 } | 854 } |
855 | 855 |
856 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, | 856 v8::Local<v8::Context> toV8ContextEvenIfDetached(LocalFrame* frame, |
857 DOMWrapperWorld& world) { | 857 DOMWrapperWorld& world) { |
858 ASSERT(frame); | 858 ASSERT(frame); |
859 return frame->windowProxy(world)->contextIfInitialized(); | 859 return frame->script().windowProxy(world)->contextIfInitialized(); |
860 } | 860 } |
861 | 861 |
862 void crashIfIsolateIsDead(v8::Isolate* isolate) { | 862 void crashIfIsolateIsDead(v8::Isolate* isolate) { |
863 if (isolate->IsDead()) { | 863 if (isolate->IsDead()) { |
864 // FIXME: We temporarily deal with V8 internal error situations | 864 // FIXME: We temporarily deal with V8 internal error situations |
865 // such as out-of-memory by crashing the renderer. | 865 // such as out-of-memory by crashing the renderer. |
866 CRASH(); | 866 CRASH(); |
867 } | 867 } |
868 } | 868 } |
869 | 869 |
(...skipping 147 matching lines...) Loading... |
1017 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 1017 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
1018 parsed, tryCatch)) { | 1018 parsed, tryCatch)) { |
1019 if (tryCatch.HasCaught()) | 1019 if (tryCatch.HasCaught()) |
1020 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 1020 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
1021 } | 1021 } |
1022 | 1022 |
1023 return parsed; | 1023 return parsed; |
1024 } | 1024 } |
1025 | 1025 |
1026 } // namespace blink | 1026 } // namespace blink |
OLD | NEW |